// view controller implementation
@property (weak, nonatomic) IBOutlet UIView *v;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//self.v.layer.backgroundColor = [UIColor blackColor].CGColor;
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_4);
self.v.layer.affineTransform = transform;
}
@end
我已经成功地将UIView *v
连接到接口构建器中的UIView
对象。但是由于某种原因,当self.v.layer.affineTransform = transform;
被执行时,当我构建并运行v
时,它从屏幕上消失了。这有什么不对吗?我该怎么解决这个问题?另外,我将对象的背景色设置为蓝色,以便在屏幕上可见。
self.v.transform = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI_4);
试试这个。