【发布时间】:2011-01-12 19:49:51
【问题描述】:
我有一个对象,它是 UIView 的子类,可以作为子视图添加到视图层次结构中。我希望能够从其 superView 中删除 UIView 并将其添加为主窗口的子视图,然后展开到全屏。
类似的东西:
// Remove from superView and add to mainWindow
[self retain];
[self removeFromSuperView];
[mainWindow addSubView:self];
// Animate to full screen
[UIView beginAnimations:@"expandToFullScreen" context:nil];
[UIView setAnimationDuration:1.0];
self.frame = [[UIScreen mainScreen] applicationFrame];
[UIView commitAnimations];
[self release];
首先,我是否在正确的路线上?其次,是否有一种简单的方法让对象获得指向主窗口的指针?
谢谢
戴夫
【问题讨论】:
-
回答你的第二个问题:UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];