我有一个UITableViewCell的子类,里面有按钮。该按钮具有明确的backgroundColor
边框。我想从按钮的中心开始填充动画。我的问题是动画立即完成。这是我的代码,我尝试过两种不同的方式。
- (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;
}];
但动画会在每种情况下立即完成。点击self.goingButton
答案 0 :(得分:1)
我的问题是,在致电goingButtonAnimation
后,我致电[self.tableView reloadData]