我正在尝试为子视图的框架制作动画,但它不起作用:
[UIView animateWithDuration:0.5
animations:^{
NSLog(@"BIIIM %@", [_subView subviews]);
UIImageView *imageView1 = (UIImageView *)[self.view viewWithTag:(1)];{
imageView1.frame = CGRectMake(76.8 , -100, 33.4, 164);
imageView1.alpha = 0.5;
}
alpha的动画工作得很好,但框架的动画不是......任何想法? 谢谢!
答案 0 :(得分:0)
我做了如下的简单测试,发现它工作正常。 alpha和frame都发生了变化。
- (void)viewDidLoad
{
[super viewDidLoad];
UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
imageView1.backgroundColor = [UIColor redColor];
[self.view addSubview:imageView1];
[UIView animateWithDuration:2 animations:^{
imageView1.frame = CGRectMake(20, 20, 100, 100);
imageView1.alpha = 0.5;
}];
}