iPhone 6上的Self.view.frame.size.width不正确

时间:2016-03-08 21:20:48

标签: ios

目前有一个升级到iOS 9的应用程序,它有一个启动屏幕文件和在资产中分配的启动图像。当使用以下内容时,获得320而不是iphone 6的正确宽度。

- (void)viewDidLoad{
    [super viewDidLoad];

    [self setUIDefaults];

    [self.cvDash registerClass:[DashEventsNewsCell class] forCellWithReuseIdentifier:@"DashCell"];
    [self.cvDash registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"WebCell"];
    self.cvDash.delegate = self;
    self.cvDash.decelerationRate = UIScrollViewDecelerationRateNormal;
    lastIndex = 0;

    self.vDashboardHeader.delegate = self;

    NSLog(@"View Width:%f",self.view.frame.size.width);
    NSLog(@"Bounds Width:%f",self.view.bounds.size.width);
    NSLog(@"Main Screen Width:%f",[[UIScreen mainScreen] bounds].size.width);
}


2016-03-08 17:14:16.069 iSOMobile[78233:5738734] View Width:320.000000
2016-03-08 17:14:17.150 iSOMobile[78233:5738734] Bounds Width:320.000000
2016-03-08 17:14:17.783 iSOMobile[78233:5738734] Main Screen Width:375.000000

enter image description here

enter image description here

0 个答案:

没有答案