TestAsyncViewController *detailViewController = [[TestAsyncViewController alloc]initWithNibName:@"TestAsyncViewController" bundle:nil];
[self.navigationController pushViewController:detailViewController animated:YES];
推送到TestAsyncViewController类控制器之后查看如何从detailViewController更新推送控制器中的数组。
特别使用指针?
答案 0 :(得分:0)
您的问题不完整,但您可以使用:
......有很多可能性,很难回答。您应该更具体,并向我们展示更多代码。
最后一个例子看起来像......
---- Your pushee view controller implementation
- (void)showAsyncViewController {
.. array is in __myArray variable ...
TestAsyncViewController *asyncViewController = [[TestAsyncViewController alloc] ...];
asyncViewController.data = __myArray;
[self.navigationController pushViewController:asyncViewController];
[asyncViewController release];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
... handle changes of __myArrat ...
}
---- interface of TestAsyncViewController
@interface TestAsyncViewController : ... {
NSMutableArray *__data;
}
@property (nonatomic,retain) NSMutableArray *data;
@end
---- implementation of TestAsyncViewController ...
@implementation TestAsyncViewController
@synthesize data = __data;
... use __data in any of your methods ...
- (void)dealloc {
[__data release]; __data = nil;
...
[super dealloc];
}
再次,它被黑暗击中,因为它不绝对清楚你想要实现什么。更具体地得到更好的答案。
答案 1 :(得分:0)
你不清楚Q,但我会告诉你这两种情况...... 假设您在viewController1并且将另一个viewController2推送到navigationController .....
现在,如果要更新viewController2表单的数组viewController1,只需将该数组作为viewController2的属性。然后您可以直接访问该数组
viewController2.array
现在假设情况是你要访问viewController1形式的视图viewController2 ......只需将该数组传递给viewController2并通过copy方法将其存储在任何变量中,或者可以通过retain方法引用它。 / p>