1
我已成功显示启动时验证用户的视图。一旦成功,我希望presentModalViewController不再可见并正确释放。解除presentModalViewController最优雅的方式?
我的代码如下:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the tab bar controller's view to the window and display.
[self.window addSubview:tabBarController.view];
Overview *overview = [[Overview alloc] initWithNibName:@"Overview" bundle:nil];
[self.tabBarController presentModalViewController:overview animated:YES];
[overview release];
[self.window makeKeyAndVisible];
return YES;
}
+1为正确答案。模态显示的viewController将把这个消息传递给最初打开模态视图的viewController。 – Till 2011-04-17 17:46:58
@说实话总是这样吗?在苹果的音乐选择器和电子邮件发送类中,委托消息将被发送到viewController,它将打开它,根据模态视图控制器上的输入决定是否解除或执行其他操作。 – 2011-04-17 18:05:29
@Zaky根据Apple的参考资料,讨论使用方法[UIViewController presentModalViewController:animated:]和[UIViewController dismissModalViewControllerAnimated:]总是这种情况。 – Till 2011-04-17 18:52:54