我有一个 UIView 的子类,它正在绘制一个位置图标。当我将视图旋转几度时,它的边界(使用绿色突出显示CGContextAddRect
)似乎发生了巨大变化,导致我的绘图看起来失真。
(来源:bytolution.com)
(来源:bytolution.com)
这是我的代码:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.locationTagView.frame = CGRectMake(40, 80, 240, 240);
CGAffineTransform transform = CGAffineTransformMakeRotation(DegreesToRadians(30));
self.locationTagView.transform = transform;
[self.view addSubview:self.locationTagView];
}