viewwillappear解雇后如何打电话modalviewcontroller?
有任何想法,因为在解雇后我viewwillappear没有被称为:
以模态方式呈现我的viewcontroller:// firsviewcontroller:
-(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);
}
Run Code Online (Sandbox Code Playgroud)
// secondvioewcontroller:我创建了一个alertview来解除这个模态视图,但是没有调用viewwillapear:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0){
if ([self respondsToSelector:@selector(presentingViewController)]){
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else {
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
}
}
Run Code Online (Sandbox Code Playgroud) 在我firstviewcontroller提出的一个modalviewcontroller,然后通过一个动作,我调用一个方法,显示一个警报并解雇modalview,但当它消失时,viewWillAppear不会被调用:
firstviewcontroller
-(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);
}
//in secondviewcontroller I use an alert view that call this method in order to dismiss modalview
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0){
if ([self respondsToSelector:@selector(presentingViewController)]){
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else {
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
}
}
Run Code Online (Sandbox Code Playgroud)
当它消失,viewWillAppear不被称为,我想要的是什么