我正在尝试使用如下多个数据的initWithData视图控制器:
NewsDetailViewController *anotherViewController = [[NewsDetailViewController alloc] initWithData:[oldEntries objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:anotherViewController animated:YES];
[anotherViewController release];
[newsTableView deselectRowAtIndexPath:indexPath animated:NO];
所以这是当前的:InitWithData:initWithData:[oldEntries objectAtIndex:indexPath.row]];
现在我需要InitWithData来推送其中两个对象:
[oldEntries objectAtIndex:indexPath.row];
[reviewEntries objectAtIndex:indexPath.row];
我该怎么做?
我在NewsDetailController中收到了这样的当前数据:
- (id)initWithData:(NSDictionary *)data {
if (self == [super init]) {
rssData = [data copy];
}
return self;
}
rssData是一个NSDictionary ..
答案 0 :(得分:1)
将您的init方法更改为
- (id)initWithOldData:(NSDictionary *)oldData
andReviewData:(NSDictionary *)revData {
if (self == [super init]) {
rssOldData = [oldData copy];
rssReviewData = [revData copy];
}
return self;
}
并使用
调用它[[NewsDetailViewController alloc]
initWithOldData:[oldEntries objectAtIndex:indexPath.row]
andReviewData:[reviewEntries objectAtIndex:indexPath.row]];
当然,您还需要在rssOldData
中声明rssReviewData
和NewsDetailViewController
。