0

我正在尝试为子视图的框架设置动画,但它不起作用:

[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 的动画工作得很好,但帧的动画不是......知道吗?谢谢!

4

1 回答 1

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;
    }];

}
于 2013-03-15T00:36:35.327 回答