Reputation: 69
I am trying to InitWithData a viewcontroller with multiple data like this:
NewsDetailViewController *anotherViewController = [[NewsDetailViewController alloc] initWithData:[oldEntries objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:anotherViewController animated:YES];
[anotherViewController release];
[newsTableView deselectRowAtIndexPath:indexPath animated:NO];
So this is the current: InitWithData:initWithData:[oldEntries objectAtIndex:indexPath.row]];
Now I need the InitWithData to push 2 of these objects:
[oldEntries objectAtIndex:indexPath.row];
[reviewEntries objectAtIndex:indexPath.row];
How can I do this?
I receive the current data like this in the NewsDetailController:
- (id)initWithData:(NSDictionary *)data {
if (self == [super init]) {
rssData = [data copy];
}
return self;
}
And rssData is a NSDictionary..
Upvotes: 0
Views: 224
Reputation: 3355
change your init method to
- (id)initWithOldData:(NSDictionary *)oldData
andReviewData:(NSDictionary *)revData {
if (self == [super init]) {
rssOldData = [oldData copy];
rssReviewData = [revData copy];
}
return self;
}
and call it using
[[NewsDetailViewController alloc]
initWithOldData:[oldEntries objectAtIndex:indexPath.row]
andReviewData:[reviewEntries objectAtIndex:indexPath.row]];
Of course you need to declare rssOldData
and rssReviewData
in your NewsDetailViewController
too.
Upvotes: 1