【问题标题】:Subview of UITabBarController when rotating is underneath旋转时UITabBarController的子视图在下方
【发布时间】:2012-06-17 21:44:55
【问题描述】:

我正在向 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]];

    } ];

【问题讨论】:

    标签: iphone uiviewcontroller rotation


    【解决方案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];
    }
    

    【讨论】:

      猜你喜欢
      • 2010-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多