gpt4 book ai didi

ios - Viewwillappear 在关闭 modalviewwontroller 后未调用

转载 作者:行者123 更新时间:2023-12-01 17:55:43 26 4
gpt4 key购买 nike

在我的firstviewcontroller我提出了 modalviewcontroller ,然后通过一个 Action 我调用一个显示警报并关闭 modalview 的方法,但是当它消失时 viewWillAppear 不会被调用:

第一 View Controller

-(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];
}
}
}

当它消失时, viewWillAppear不叫,我想念什么

最佳答案

更改以下代码它将起作用:

 addViewController.modalPresentationStyle = UIModalPresentationFullScreen;

它会工作。

关于ios - Viewwillappear 在关闭 modalviewwontroller 后未调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18063578/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com