iOS BUG: Unbalanced calls to begin/end appearance transitions for <XXXViewController: 0x7fcea3730650>.
自定义TabBarController Push下一级Controller时 会报这样的错误:Unbalanced calls to begin/end appearance transitions for <XXXViewController: 0x7fcea3730650>.
网上的一些回答,都说是动画引起的,解决方法就是,加一个BOOL型的变量,检查是否在做动画。
if (transiting) {
return;
}
transiting = YES;
[self transitionFromViewController:_currentVC toViewController:newVC duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
} completion:^(BOOL finished) {
transiting = NO;
}];
这样就不会出现刚才说的那个bug了。
但是,这并没有解决我的问题!
所以真正的答案是
自定义了TabBarController 之后必须实现以下
-(void)viewWillAppear:(BOOL)animated
{
[self.selectedViewController beginAppearanceTransition: YES animated: animated];
}
-(void) viewDidAppear:(BOOL)animated
{
[self.selectedViewController endAppearanceTransition];
}
-(void) viewWillDisappear:(BOOL)animated
{
[self.selectedViewController beginAppearanceTransition: NO animated: animated];
}
-(void) viewDidDisappear:(BOOL)animated
{
[self.selectedViewController endAppearanceTransition];
}
相关文章
- 阿里 iOS 程序员绩效打了3.25分,留下报复性bug?
- IOS开发之xcode 快捷键
- iOS 证书Bug The identity used to sign the executable is no longer valid 解决方案
- iOS项目开发实战——网页源码实现二进制和HTML的转换
- 免费素材下载:iOS 8 矢量 UI 素材套件
- IOS底层原理 - 1.OC对象本质
- iOS完整推流采集音视频数据编码同步合成流
- AVFoundation关于 iOS 中的视频压缩
- iOS 自定义页面的切换动画与交互动画 By Swift
- iOS移动开发周报-第24期
- iOS开发基础知识--碎片14
- iOS开发UI篇—CAlayer(创建图层)