Removing a UIView from its superView and expanding its frame to full screen

Posted by Magic Bullet Dave on Stack Overflow See other posts from Stack Overflow or by Magic Bullet Dave
Published on 2011-01-12T19:49:51Z Indexed on 2011/01/12 19:53 UTC
Read the original article Hit count: 234

Filed under:
|

I have an object that is a subclass of UIView that can be added to a view hierarchy as a subView. I want to be able to remove the UIView from its superView and add it as a subView of the main window and then expand to full screen.

Something along the lines of:

// Remove from superView and add to mainWindow
[self retain];
[self removeFromSuperView];
[self addSubView:mainWindow];

// Animate to full screen
[UIView beginAnimations:@"expandToFullScreen" context:nil];
[UIView setAnimationDuration:1.0];
self.frame = [[UIScreen mainScreen] applicationFrame];
[UIView commitAnimations];

[self release];

Firstly am I on the right lines? Secondly, is there an easily way for the object to get a pointer to the mainWindow?

Thanks

Dave

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiview