【发布时间】:2011-07-07 08:48:35
【问题描述】:
我想从一个 ViewController 导航到另一个。作为其中的一部分,我想 通过 ViewController 我想导航到一些信息。我封装了 信息到我想作为外部对象与目标挂钩的对象中 视图控制器。
我在 IB 中创建了外部对象,并为它提供了我在 NSDictionary 中引用的标识符,该标识符传递给 NibLoading 方法。
NSArray* topLevelObjs = nil;
NSMutableDictionary* options = [[NSMutableDictionary alloc] initWithCapacity:1];
NSMutableDictionary* config = [[NSMutableDictionary alloc] initWithCapacity:1];
id detailImageVC = [[SelectedImageModalViewController alloc] init];
SelectedImageModalModel* selectImageModalModel = [[SelectedImageModalModel alloc] init];
selectImageModalModel.imageName = @"img@2x.png";
[config setValue:selectImageModalModel forKey:@"SelectImageModalModel"];
[options setValue:config forKey:UINibExternalObjects];
topLevelObjs = [[NSBundle mainBundle] loadNibNamed:@"SelectedImageModalViewController" owner:detailImageVC options:options];
if ([topLevelObjs count] == 0)
{
NSLog(@"Warning! Could not substitute proxy objects in xib file.\n");
return;
}
[appDelegate.navigationController presentModalViewController:detailImageVC animated:YES];
[options release];
[config release];
[selectImageModalModel release];
[detailImageVC release];
我的预期是,在我调用 presentModalViewController:animated: 之后,我会在与我的外部对象相同的 detailImageVC 上收到对 viewDidLoad 的调用 连接的。
相反,两者都没有发生。 viewWillApear: 将被调用,但 detailImageVC 不会保存我的外部引用。
感谢任何想法、意见或评论。谢谢!
【问题讨论】:
标签: iphone ios nib viewcontroller viewdidload