iqidan

导航

Unbalanced calls to begin/end appearance transitions for **

在自定义UITabBarController中点击视图跳转的时候,有可能就出现这个问题, 解决方法就是在自定义的UITabBarController中的视图显示消失通知方法中添加如下方法:

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

}

 

 

文档解释:

// If a custom container controller manually forwards its appearance callbacks, then rather than calling

// viewWillAppear:, viewDidAppear: viewWillDisappear:, or viewDidDisappear: on the children these methods

// should be used instead. This will ensure that descendent child controllers appearance methods will be

// invoked. It also enables more complex custom transitions to be implemented since the appearance callbacks are

// now tied to the final matching invocation of endAppearanceTransition.

- (void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

- (void)endAppearanceTransition __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

 

posted on 2016-02-28 11:33  iqidan  阅读(457)  评论(1编辑  收藏  举报