Try This in your UITableView subclass.
override func insertRowsAtIndexPaths(indexPaths: [NSIndexPath], withRowAnimation animation: UITableViewRowAnimation) {
super.insertRowsAtIndexPaths(indexPaths, withRowAnimation: UITableViewRowAnimation.None)
self.endUpdates()
self.beginUpdates()
for indexPath:NSIndexPath in indexPaths{
let cell:UITableViewCell? = (super.cellForRowAtIndexPath(indexPath));
if cell != nil {
var frame:CGRect = (cell?.frame)!
frame.origin.x = (cell?.frame.size.width)!
cell?.frame = frame
frame.origin.x = 0;
let animationBlock = {() -> Void in
cell!.frame = frame;
}
if UIView.respondsToSelector(Selector("animateWithDuration(duration: , delay: , usingSpringWithDamping dampingRatio: , initialSpringVelocity velocity: , options: , animations: , completion: ")){
// UIView.animateWithDuration(0.3, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.0, options:0.0, animations: animationBlock, completion:nil)
UIView.animateWithDuration(0.3, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: animationBlock, completion: nil)
}else{
UIView.animateWithDuration(0.3, delay: 0.0, options:UIViewAnimationOptions.CurveEaseIn, animations: animationBlock, completion: nil)
}
}
}
}
Это может помочь: HTTP: //stackoverflow.com/questions/11379614/can-you-do-custom-animations-for-uitableview-cell-inserts –
@johnykumar спасибо. да, я это видел. проблема заключается в том, что она написана в ObjC, и я не могу реплицировать решение, к сожалению. –
ok Позвольте мне попробовать быстро, ответит вам в ближайшее время. –