Я получил dismissModalViewControllerAnimated для правильной работы со следующей настройкой, но не понимаю, почему он работает на себя (modalViewController), а не 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];
}
У меня вопрос, почему [self dismissModalViewControllerAnimated] работает, а не [self.parentViewController dismissModalViewControllerAnimated] ??Это новое в iOS 5?Я думал, что только parentViewController способен отклонить дочернее модальное представление?
Спасибо!