Quote:
Originally Posted by Bertrand21
Code:
// get the view that's currently showing
UIView *currentView = self.view;
// get the the underlying UIWindow, or the view containing the current view view
UIView *theWindow = [currentView superview];
// remove the current view and replace with myView1
[currentView removeFromSuperview];
//[theWindow addSubview:newView];
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
|
I have a couple questions about memory management using this code.
Assuming this is a method inside a UIViewController, when does this object get released? Its view isn't in the window anymore so it should be save to release right?
Who is retaining the newView's view controller? Where is it alloc-init-ed? If I want to initialized it from a nib, then load the view this way, will the view controller stick around beyond the end of this method?