我想旋转uilabel,在iOS7和iOS8中似乎有所不同。任何人都可以解释原因吗?
这是我的演示代码,使用pureLayout设置autolayout:
UIView *view = [UIView newAutoLayoutView];
[self.view addSubview:view];
[view autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:20];
[view autoAlignAxisToSuperviewAxis:ALAxisVertical];
[view autoSetDimensionsToSize:CGSizeMake(20, 100)];
view.backgroundColor = [UIColor lightGrayColor];
UILabel *topLabel = [UILabel newAutoLayoutView];
[view addSubview:topLabel];
topLabel.backgroundColor = [UIColor redColor];
topLabel.text = @"The top label text";
[topLabel autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom];
CGAffineTransform tran = CGAffineTransformMakeRotation(-M_PI_2);
topLabel.transform = tran;
和topLabel的框架:
iOS8:{{-1.25, 1.25}, {22.5, 20}}
iOS7:{{0, 0}, {20, 135}}
iOS7的结果是我想要的。当我使用IB进行自动布局时,同样的结果
答案 0 :(得分:0)
人们似乎认为它与iOS 7和8中的约束行为有关。Animation of CGAffineTransform in iOS8 looks different than in iOS7