在ios8 中transform布局根据frame布局的,但是在ios9中是根据center布局的,所以在ios9中写法这样子是没问题的
_pv = [[UIPickerView alloc]initWithFrame:CGRectMake(width / 2.0 - height/2.0f, width/2.0-height/2.0f, 75, width)];
_pv.center = CGPointMake(width/2.0f, height/2.0f);
//加入把这句话去掉,在ios8和9中效果不一样的。
_pv.dataSource = self;
_pv.delegate = self;
_pv.layer.anchorPoint = CGPointMake(0.5, 0.5);
_pv.transform = CGAffineTransformMakeRotation(-M_PI/2);
在iOS8中,使用transform布局依赖于frame布局,而在iOS9中,布局方式改为基于center。本文详细解释了这种变化,并提供了一个实例代码,展示了如何在iOS9中正确实现布局调整。
457

被折叠的 条评论
为什么被折叠?



