问题描述: 在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.