2014-10-30 47 views
0

我有一个UITableViewCell的子类,里面有按钮。该按钮有一些边框清除backgroundColor。我想从按钮的中心开始填充动画。我的问题是动画立即完成。这是我的代码,我尝试了两种不同的方式。UITableViewCell中的动画立即完成

- (void)goingButtonAnimation { 
    UIView *goingButtonBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(self.goingButton.center.x, self.goingButton.center.y, 0., 0.)]; 
    goingButtonBackgroundView.layer.cornerRadius = 2.; 
    goingButtonBackgroundView.backgroundColor = [UIColor blackColor]; 
    [self insertSubview:goingButtonBackgroundView belowSubview:self.goingButton]; 

    [UIView animateWithDuration:2. animations:^{ 
     goingButtonBackgroundView.frame = self.goingButton.frame; 
    }]; 
} 

我也试过这样:

goingButtonBackgroundView.transform = CGAffineTransformMakeScale(0.1, 0.1); 
[UIView animateWithDuration:2. animations:^{ 
    goingButtonBackgroundView.transform = CGAffineTransformMakeScale(1.0, 1.0); 
    goingButtonBackgroundView.center = self.goingButton.center; 
}]; 

但动画在每种情况下立即完成。 goingButtonAnimation法攻上self.goingButton

回答

1

我的问题之后调用是调用goingButtonAnimation后,我叫[self.tableView reloadData]