Link to count me in blocks

I am trying to understand how object life and reference counting interact with blocks of code. In the following code, I just do a simple animation that blinks when the top view in the UINavigationController stack is exchanged. The tricky part is that the popped view controller is the one where this code is defined.

[UIView animateWithDuration:0.2 
        animations:^{self.navigationController.view.alpha = 0.0;}
        completion:^(BOOL finished){ 
                UINavigationController *navController = self.navigationController;  

                [self.navigationController popViewControllerAnimated:NO]; 
                [navController pushViewController:nextView animated:NO];
                [nextView release];

                [UIView animateWithDuration:0.2 
                        animations:^{navController.view.alpha = 1.0;}];                    
                 }];    

My question (ignoring what the animation looks like) is the right way to do this in terms of memory management. In particular:

(1) When using this approach for the pop + push cycle, is it right that you no longer need to save yourself, as in other similar examples , that you do not use blocks?

(2) Does animateWithDuration: ... invoke the defining view controller (self) with these blocks until the blocks are executed?

+3
1

(1) pop + push, , , , ?

. self, navController nextView, nextView .

(2) animateWithDuration:... (self), ?

. . self, navController nextView.

+5

All Articles