Oua*_*den 1 objective-c uiviewcontroller ios
在我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不被称为,我想要的是什么
更改下面的代码它将起作用:
addViewController.modalPresentationStyle = UIModalPresentationFullScreen;
Run Code Online (Sandbox Code Playgroud)
它会工作.
| 归档时间: |
|
| 查看次数: |
4317 次 |
| 最近记录: |