为什么 UIImageView 不旋转?
我需要围绕中心框架渲染片段,但它没有旋转。
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
_baseImage = [UIImage imageNamed:@"setAlarmSegment.png"];
_segmentCircleArray = [[NSMutableArray alloc] initWithCapacity:16];
for (int i=0; i<16; i++) {
UIImageView *imageViewSegment = [[UIImageView alloc] initWithImage:_baseImage];
[imageViewSegment setFrame:self.frame];
imageViewSegment.transform = CGAffineTransformMakeRotation((M_PI*2/16.0f)*i);
[_segmentCircleArray addObject:imageViewSegment];
}
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
}
return self;
}
- (void)drawRect:(CGRect)rect
{
for (UIImageView *segment in _segmentCircleArray) {
[segment drawRect: rect];
}
}
谢谢。