UIWebthreadlock freezes app
I have a view in wich I present two different uiwebviews (loaded from local html). Everytime the user taps a button located in the navigation bar, I switch from one webview to another with a page curl animation (curl up and curl down). Everything seems to work fine but sometimes the app freezes when the user tap that button. In most cases the app freezes when I tap the button repeteadly until the app freezes, then I pause the debug and I get this:

![enter image description here][1]


  [1]: http://i.stack.imgur.com/hDdwB.png

       

    self.navigationItem.titleView.userInteractionEnabled = NO; //Disable button interaction until animation is finished
    
     if (self.isVisibleFrontView) 
        {
        self.isVisibleFrontView = NO;
        
        [UIView transitionWithView:self.view
                          duration:0.5
                           options:UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
                        animations:^{
                            [[[self.view subviews] objectAtIndex:0] removeFromSuperview];
                            [self.view addSubview:self.patientViewReverse];
                            
                        }
                        completion:^(BOOL finished){
                            self.navigationItem.titleView.userInteractionEnabled = YES;
                        }];
    }
    else 
    {
       
        self.isVisibleFrontView = YES;
        
        [UIView transitionWithView:self.view
                          duration:0.5
                           options:UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionCurveEaseInOut
                        animations:^{
                            [[[self.view subviews] objectAtIndex:0] removeFromSuperview];
                            [self.view addSubview:self.patientView];
                            
                        }
                        completion:^(BOOL finished){
                                self.navigationItem.titleView.userInteractionEnabled = YES;
                           
                        }];
        
    }
    [self showNavigationBarButtons]; //change button image
    }

I think webView is acquiring lock when removeFromSuperview but in some cases never release it, resulting in a main thread freeze. What do you think? What is the best approach to achieve this without freezing the app?

Thanks in advance guys.
UIWebthreadlock freezes app
===

I have a view in wich I present two different uiwebviews (loaded from local html). Everytime the user taps a button located in the navigation bar, I switch from one webview to another with a page curl animation (curl up and curl down). Everything seems to work fine but sometimes the app freezes when the user tap that button. In most cases the app freezes when I tap the button repeteadly until the app freezes, then I pause the debug and I get this:

![enter image description here][1]


  [1]: http://i.stack.imgur.com/hDdwB.png

       

    self.navigationItem.titleView.userInteractionEnabled = NO; //Disable button interaction until animation is finished
    
     if (self.isVisibleFrontView) 
        {
        self.isVisibleFrontView = NO;
        
        [UIView transitionWithView:self.view
                          duration:0.5
                           options:UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
                        animations:^{
                            [[[self.view subviews] objectAtIndex:0] removeFromSuperview];
                            [self.view addSubview:self.patientViewReverse];
                            
                        }
                        completion:^(BOOL finished){
                            self.navigationItem.titleView.userInteractionEnabled = YES;
                        }];
    }
    else 
    {
       
        self.isVisibleFrontView = YES;
        
        [UIView transitionWithView:self.view
                          duration:0.5
                           options:UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionCurveEaseInOut
                        animations:^{
                            [[[self.view subviews] objectAtIndex:0] removeFromSuperview];
                            [self.view addSubview:self.patientView];
                            
                        }
                        completion:^(BOOL finished){
                                self.navigationItem.titleView.userInteractionEnabled = YES;
                           
                        }];
        
    }
    [self showNavigationBarButtons]; //change button image
    }

I think webView is acquiring lock when removeFromSuperview but in some cases never release it, resulting in a main thread freeze. What do you think? What is the best approach to achieve this without freezing the app?

Thanks in advance guys.