unbalanced calls to begin/end appearance transitions for uiviewcontroller的解决方法
1、ios开发中,进行视图跳转时,可能会遇到上面的警告日志,
比如,在loadView、viewDidLoad、viewWillAppear中,使用下面的代码:
XXXView* viewTemp = [[PrimaryView alloc] init];
viewTemp.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:viewTemp animated:YES completion:nil];
解决办法:
在viewDidAppear中执行上述代码即可;
2、视图跳转无效解决
[self dismissViewControllerAnimated:YES completion:nil];
// YES会导致下面一行代码执行时,视图无法跳转
XXXView* viewTemp = [[PrimaryView alloc] init];
viewTemp.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:viewTemp animated:YES completion:nil];
解决办法:
[self dismissViewControllerAnimated:YES completion:^{
XXXView* viewTemp = [[PrimaryView alloc] init];
viewTemp.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:viewTemp animated:YES completion:nil];
}];