Monday, 7 January 2013

UITableView - Reload table view with smooth animation

//Put this code where you want to reload your table view
dispatch_async(dispatch_get_main_queue(), ^{
        [UIView transitionWithView:<"TableName">
                          duration:0.1f
                           options:UIViewAnimationOptionTransitionCrossDissolve
                        animations:^(void) {
                            [<"TableName"> reloadData];
                        } completion:NULL];       
    });

5 comments:

  1. thanks , it work perfectly :)

    ReplyDelete
  2. I just have a small question, why is it in a dispatch_async? Thank you.

    ReplyDelete
  3. Thanks you very much for the hint

    ReplyDelete
  4. @Alaa It's performing the animation on the same thread, it's just positioning it at an optimal place in the run loop

    ReplyDelete