如何在解除了modalviewcontroller
后调用viewwillappear
?
请提供任何想法,因为在解除我的modalviewcontroller
后,viewwillappear
没有被调用:
以模态方式呈现我的视图控制器: //第一个视图控制器:
-(IBAction)AddActivity:(id)sender{
CreateActivity *addViewController = [[CreateActivity alloc] initWithNibName:@"CreateActivity" bundle:nil];
addViewController.delegate = self;
addViewController.modalPresentationStyle = UIModalPresentationFormSheet;
addViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:addViewController animated:YES];
addViewController.view.superview.frame = CGRectMake(50, 260, 680, 624);
}
//secondvioewcontroller:我创建了一个alertview来关闭这个modalview,但是viewwillapear没有被调用:
//secondvioewcontroller: 我使用了一个alertView来dismiss这个modalView,但是viewWillAppear方法没有被调用。
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0){
if ([self respondsToSelector:@selector(presentingViewController)]){
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else {
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
}
}