旋转时UITabBarController的子视图位于下方

时间:2012-06-17 21:44:56

标签: iphone uiviewcontroller rotation

我正在向tabbarcontroller添加通知/警报类型视图,这是我的应用程序rootview控制器,以便我获得自动旋转优势。

但是,当我的警报视图旋转时,最终会出现在导航栏和标签栏下方。

http://dl.dropbox.com/u/6851931/2012-06-17%2011.08.42.jpg

http://dl.dropbox.com/u/6851931/2012-06-17%2011.08.47.jpg

这两张图片展示了它在旋转时的作用以及不旋转时的样子。反正有没有让视图始终位于顶部并获得旋转支持?

以下是我添加视图的代码。

[self.customImageView whenTapped:^{

        MA_MobileAppDelegate *appDelegate = (MA_MobileAppDelegate *)[[UIApplication sharedApplication] delegate];

        UAModalPanel *modalPanel = [[MSPicturePreview alloc] initWithFrame:appDelegate.tabBarController.view.bounds withimage:self.customImageView.image];

        [appDelegate.tabBarController.view addSubview:modalPanel];


        [modalPanel showFromPoint:[self.contentView convertPoint:[self.customImageView center] toView:appDelegate.tabBarController.view]];

    } ];

1 个答案:

答案 0 :(得分:1)

你可以手动将它带到前面, 当您创建modalPanel添加标签

modalPanel.tag = 111;
视图控制器willRotateToInterfaceOrientation上的

执行以下操作

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    //Get the modalPanel
    UAModalPanel *modalPanel = [appDelegate.tabBarController.view viewWithTag:111];
    //Bring it to front
    [appDelegate.tabBarController.view bringSubviewToFront:modalPanel];
}
相关问题