【问题标题】:iOS8 Full Screen View is cut offiOS8 全屏视图被切断
【发布时间】:2014-11-30 14:46:19
【问题描述】:

在 iOS7 中,我可以使用以下代码创建全屏视图:

- (void)loadView {
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    CGRect frame = CGRectMake(0, 0, screenSize.height, screenSize.width);
    UIView *view = [[UIView alloc] initWithFrame: frame];

    self.view = view;
}

移动到iOS8时这段代码不能正常工作,屏幕在右侧被截断并缩放,类似这样:

---------------   ---------------   
|             |   |         |   |
|     iOS7    |   | iOS8    |   |
| Full Screen |   | Cut Off |   |
|             |   |         |   |
|             |   |         |   |
---------------   ---------------

这会影响我的应用程序中以编程方式生成的所有全屏视图,这里有什么想法吗?

【问题讨论】:

    标签: ios ios7 ios8


    【解决方案1】:

    代替:

    CGRect frame = CGRectMake(0, 0, screenSize.height, screenSize.width);
    

    你需要

    CGRect frame = CGRectMake(0, 0, screenSize.width, screenSize.height);
    

    它的:

    CGRect CGRectMake ( CGFloat x, CGFloat y, CGFloat width, CGFloat height ); 
    

    【讨论】:

    • 这行得通,谢谢!,但是任何想法为什么这在 iOS7 中可以正常工作?我应该注意到该应用程序是横向模式。
    • 在 iOS UIScreen 上现在是面向界面的,查看更多stackoverflow.com/questions/24150359/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多