0
votes

I have a subclass of UITableViewCell with button inside of it. The button have clear backgroundColor with some border. I want to do a fill in animation starting from the center of the button. My problem is that animation completes immediately. Here's my code, I've tried doing this in 2 different ways.

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

I've also tried this:

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

But the animation completes immediately in each case. goingButtonAnimation method is called after tapping on self.goingButton

1

1 Answers

1
votes

My problem was that after calling goingButtonAnimation I called [self.tableView reloadData]