【发布时间】:2014-07-29 14:13:27
【问题描述】:
我有一个以编程方式调用的 UIImageView,我试图让它旋转但它不起作用。图像将放置在动态 UITableView 中(我无法将其更改为静态)。该图像在我的表格视图中看起来很好,但它只是不旋转。
- (void)viewDidLoad
{
[super viewDidLoad];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 122, 38, 38)];
imageView.image = [UIImage imageNamed:@"settings1.png"];
[self.view addSubview:imageView];
CABasicAnimation *spin;
spin = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
spin.fromValue = [NSNumber numberWithFloat:0];
spin.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
spin.duration = 4;
spin.repeatCount = 10*1000;
[imageView.layer addAnimation:spin forKey:@"360"];
【问题讨论】:
标签: xcode uitableview uiimageview cabasicanimation