【问题标题】:Strange position of modal view模态视图的奇怪位置
【发布时间】:2013-10-25 07:57:10
【问题描述】:

我一次通过将 UIViewController 推送到导航控制器来呈现它,另一次通过初始化导航控制器的根视图来呈现它。

第一种情况:作为导航控制器的第二张幻灯片

 [self.navigationController pushViewController:riassunto animated:YES];

第二种情况:作为模式视图的根

   UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:riassunto];

        navigationController.navigationBarHidden     = NO;
        [[navigationController navigationBar] setBarStyle:UIBarStyleBlack];
        [self presentViewController:navigationController animated:NO completion:nil];

但是视图的位置不同:

第一个案例

第二种情况

似乎在第二种情况下,模态视图,视图不会向下移动以为顶部栏腾出空间。为什么?

【问题讨论】:

    标签: ios uinavigationcontroller modalviewcontroller


    【解决方案1】:

    尝试在您的第二个视图控制器中使用它:

    riassunto.edgesForExtendedLayout = UIRectEdgeNone;
    

    有关更多信息,我正在扩展此答案:

    https://stackoverflow.com/a/19585104/550034

    【讨论】:

    • 确实,在 iOS7 中,默认情况下视图会填满整个屏幕,所以你需要告诉它你不想调整视图的大小
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-27
    • 2015-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多