【发布时间】:2012-02-28 08:26:14
【问题描述】:
我想旋转 UIView,但旋转后视图会调整大小。我正在使用自动调整大小标志“UIViewAutoresizingNone”。
这是我的代码:(从layoutSubViews调用)
- (void) setVerticalLabelFrame:(CGRect)r {
r.origin.y +=100.0f;
r.size.height = 20.0f;
r.size.width = 180.0f;
[[self rotatatingView] setFrame:r];
//[[self rotatatingView] setTransform:CGAffineTransformMakeRotation(M_PI / 4.0f)];
}
这里是旋转视图的延迟初始化。
- (UIView*)rotatatingView {
if (rotatatingView == nil) {
rotatatingView = [[UIView alloc] initWithFrame:CGRectZero];
[rotatatingView setBackgroundColor:[UIColor orangeColor]];
[rotatatingView setAutoresizingMask:UIViewAutoresizingNone];
[[self imageView] addSubview:rotatatingView];
}
return rotatatingView;
}
第一个镜头带有注释的最后一行,第二个镜头未注释该行。 有什么想法吗?
【问题讨论】:
标签: objective-c uiview rotation