0

How can we change animation transition speed when deleting a row from uitableview, i checked documentation i didn't find any argument where i can specify seconds for transition speed

[self.tableViewMeeting deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationLeft];

Let me know if there is any workaround to this.

Nikunj
  • 655
  • 3
  • 13
  • 25
Abhishek B
  • 148
  • 10
  • Possible duplicate of [UITableView row animation duration and completion callback](http://stackoverflow.com/questions/3832474/uitableview-row-animation-duration-and-completion-callback) – lihudi Dec 18 '15 at 12:24
  • @Abhishek B, please use the code markup feature when showing code in your question (The"{}" button). It help's with readability, thanks :) – Peter Hornsby Dec 18 '15 at 12:26
  • @fragilecat sure., thanks – Abhishek B Dec 18 '15 at 12:27
  • @lihudi its not duplicate of my question, what i am asking is the actual transition animation that happens when the row is deleting is happening very quick so i want to get it further delayed – Abhishek B Dec 18 '15 at 12:29
  • @AbhishekB may be it is not a duplicate, but take a look at Brent’s answer that suggests enclosing the animation within a CATransaction block – lihudi Dec 18 '15 at 13:17

3 Answers3

1

Try this:

self.tableView.layer.speed = 0.3

Documentation: https://developer.apple.com/library/prerelease/ios/documentation/GraphicsImaging/Reference/CAMediaTiming_protocol/index.html

amadour
  • 1,600
  • 11
  • 20
0

Why don't you try UIView animation.

[UIView animateWithDuration:2 
                      delay:0.2 
                    options:UIViewAnimationOptionCurveEaseInEaseOut 
                 animations:^{
                     [self.tableView beginUpdates];
                     [self.tableView endUpdates];  
                 } 
                 completion:^(BOOL finished) {
                     // code
                 }
];
Haroldo Gondim
  • 7,725
  • 9
  • 43
  • 62
  • your method did half the work but not there are two animations mixing up so i set options to nil and then ran , now only one default animation right to left is happening in tableview i.e withRowAnimation: UITableViewRowAnimationAutomatic , but when there is only one row then it is doing a funny animation flying from center to left kind of. – Abhishek B Dec 18 '15 at 13:28
0
[CATransaction begin];
[tableView beginUpdates];
//...
[CATransaction setCompletionBlock: ^{
    // Code to be executed upon completion
}];
[tableView insertRowsAtIndexPaths: indexPaths
                 withRowAnimation: UITableViewRowAnimationAutomatic];
[tableView endUpdates];
[CATransaction commit];
Ravi
  • 104
  • 2
  • 14
  • where are we defining animation speed here ? – Abhishek B Dec 18 '15 at 13:23
  • This answer is copy from http://stackoverflow.com/questions/3832474/uitableview-row-animation-duration-and-completion-callback and do not answer to this question as do not contain animationDuration – Nazir Dec 18 '15 at 13:51