Reputation: 1727
I have a UITableViewCell. I'm trying to animate a progress bar when the cell comes into view. I have tried the following but it does nothing.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellId = @"TableViewCellResult";
TableViewCellResults *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (cell == nil) {
cell = [[TableViewCellResults alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
}
// Add progress bar here
// THIS DOES NOTHING
[UIView animateWithDuration:10.f animations:^{
progressBar.value = 55.f;
}];
How do I animate the UIProgressBar? The UIProgressBar does not accept 'animateWithDuration'.
I have working sample of animating the UIProgressBar in UIView (not a cell) that uses the same syntax.
Upvotes: 0
Views: 149
Reputation: 1475
Try perform animations using UIView.commmitAnimations() eg:
UIView.beginAnimations(“rotation”, context: nil)
UIView.setAnimationDuration(0.8)
cell.layer.transform = CATransform3DIdentity
cell.alpha = 1
cell.layer.shadowOffset = CGSize(width: CGFloat(0), height: CGFloat(0))
UIView.commitAnimations()
also try to perform the operation inside willDisplayCell: Method.
Refer this http://www.thinkandbuild.it/animating-uitableview-cells/ solution to perform animations inside tableview cell
Upvotes: 0