Unbalanced calls to begin/end appearance transitions for Uiviewcontroller workaround

Source: Internet
Author: User

IOS5 Uiviewcontroller added the ability to manage Uiviewcontroller, just as easy as managing Subview. Here is a blog post that is very well presented. I used it in the project to facilitate the switch of view. The following code has the effect of a fade in/out.

    1. [Self TRANSITIONFROMVIEWCONTROLLER:_CURRENTVC toviewcontroller:newvc duration:0.5 options: Uiviewanimationoptiontransitioncrossdissolve animations:^{
    2. } completion:^ (BOOL finished) {
    3. }];


But how fast the call to trigger this method will appear: Unbalanced calls to begin/end appearance transitions for Uiviewcontroller

The reason is that the last animation was not over, and then started the new animation. This causes the page to not be successfully toggled, but a white, content-free page.

The workaround is to add a variable of type bool to check whether the animation is being made.

    1. if   (transiting)  {  
    2.     return ;   
    3. }  
    4. transiting = yes;  
    5. [self transitionfromviewcontroller:_currentvc toviewcontroller:newvc  duration:0.5 options:uiviewanimationoptiontransitioncrossdissolve animations:^{  
    6.       
    7. } completion:^ (bool  finished)  {  
    8.        
    9.     transiting = NO;   
    10. }];  


This will not appear the bug that you just said.

The log unbalanced calls to Begin/end appearance transitions for Uiviewcontroller appears because of the uiviewcontroller of the container class (e.g., Uinavigationcontroller, Uitabbarcontroller) in the animation did not finish, and then start the new animation. The solution is to let the animation finish after the new animation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.