我得到了dismissModalViewControllerAnimated对以下设置正常工作,但很困惑,为什么它适用于自我(在modalViewController),而不是parentViewController。dismissModalViewControllerAnimated工作自我但不parentViewController
这里的设置:
- 我有一个UITableViewController用导航按钮调用了一个模式的看法:
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Root";
_data = [NSArray arrayWithObjects:@"One", @"Two", nil];
_detailController = [[DetailViewController alloc] init];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(showAbout)];
}
- (void)showAbout
{
AboutViewController *abv = [[AboutViewController alloc] init];
abv.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:abv animated:YES];
}
这里的模态视图控制器AboutViewController与工具栏按钮触发关闭模式的解雇动作:
- (IBAction)dismissAction:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
我的问题是为什么[自dismissModalViewControllerAnimated]工作,而不是[self.parentViewController dismissModalViewControllerAnimated]?这是iOS 5中的新功能吗?我认为只有parentViewController是可以解雇儿童模态视图?
谢谢!
由于这是有道理的,现在是越来越糊涂了。 :) – LeoAlmighty 2012-01-13 06:58:42
哇感谢为什么苹果要做到这一点... – minovsky 2012-08-29 13:07:12
'[self.presentingViewController dismissModalViewControllerAnimated:YES]!'被解雇,我目前看来我有3个级别的模式,并希望摆脱的2他们但这是带我回第二级任何想法 – 2012-09-05 20:27:51