Re: passing an object between views
Re: passing an object between views
- Subject: Re: passing an object between views
- From: John Greene <email@hidden>
- Date: Wed, 20 Aug 2008 09:47:55 -0700
Graham Cox wrote:
>
> On 20 Aug 2008, at 10:31 am, John Greene wrote:
>
>> I had originally thought that I could
>> just write a method, setTableData in the secondary controller, that
>> takes an object as an argument, and then use that object to build the
>> secondary table. This is apparently forbidden by the language, so
>> what's the proper approach?
>
>
> Can you elaborate on why you think this is "forbidden by the
> language"? I can't think of any reason why this wouldn't work
> conceptually - let's see the code!
>
> cheers, Graham
Hi,
Thanks for the response. OK, fair enough; the question had some obvious
flaws, I'll try again. ;)
Here's a single element of the array I've created via NSXMLParser:
{
AddressLine = "41st Avenue at Main St.";
CountryCode = US;
PerformanceList = (
Shows = (
"21:30:00"
);
"Duration" = PT120M;
"Title" = "My show";
},
Shows = (
"19:15:00",
"21:15:00"
);
"Duration" = PT80M;
"Title" = "My Nother Show";
},
{
Shows = (
"19:30:00"
);
"Duration" = PT93M;
"Title" = "Blagga";
}
Municipality = Portland;
Name = "Fred's Theater";
Phone = "(503)5551212";
PostalCode = 97213;
Region = OR;
}
Here's the method that handles the selection:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(dvController == nil)
{
theaterDetailController *aController = [[theaterDetailController alloc] initWithNibName:@"theaterDetailView" bundle:nil];
self.dvController = aController;
[aController release];
}
[dvController updateRowNumber:indexPath.row];
[[self navigationController] pushViewController:dvController animated:YES];
}
I've tried a couple of things to make the object available to
theaterDetailController with no success:
* Creating a method:
-(void)setTableData:(NSDictionary)myTheater {
NSLog(@"myTheater is ", myTheater);
}
Which throws "can not use an object as parameter to a method",
hence my "language forbids it" remark.
* Setting a property of dvController directly:
dvController.items = items;
Which throws "request for member 'items' in something not a
structure or union".
What I'm trying to do is use the row index to select from the array of
theaters, and display details about the theater, as well as a tableview
of shows.
Thanks again!
John
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden