6s 手机出现的布局问题

问题描述: 在tableview 的cell中添加CellVC.view ,运行在模拟器iPhone 5sUI正常. 在换个6s模拟器后,UI不正常了.

测试代码如下:

UITableViewCell*cell  = [tableViewdequeueReusableCellWithIdentifier:@"identifier"];

    if(!cell) {

      cell = [[UITableViewCell alloc]   initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"identifier"];

        [cellsetSelectionStyle:UITableViewCellSelectionStyleNone];

    }

    if(!_vc) {

        _vc = [[CellVC alloc] init];

    }

    NSLog(@"befire====%@",_vc.view);

    [cell.contentView addSubview:_vc.view];

    NSLog(@"after====%@",_vc.view);

    returncell;


cellVC中,打印self.view.frame时,

-(void)viewDidLayoutSubviews {

    NSLog(@"self ====%@",self.view);

}


打印三者frame.

2019-06-06 10:20:02.812723+0800 animationTest[2916:71753] befire====<UIView: 0x7f9e0dd20e00; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x600003a447c0>>

2019-06-06 10:20:02.812987+0800 animationTest[2916:71753] after====<UIView: 0x7f9e0dd20e00; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x600003a447c0>>

2019-06-06 10:20:02.814028+0800 animationTest[2916:71753] self ====<UIView: 0x7f9e0dd20e00; frame = (0 0; 430 668); autoresize = W+H; layer = <CALayer: 0x600003a447c0>>


测试5s ,7p,6s,8,其中 6s,8 的frame.size.width会莫名编程430.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容