开发者

How to Create Custom UITableViewCell Editing Transition?

开发者 https://www.devze.com 2022-12-24 19:17 出处:网络
I have a custom UITableViewCell which has an image & and some text. When entering editing mode, I would like the image to fade out & move offscre开发者_JAVA百科en to the left. When & how d

I have a custom UITableViewCell which has an image & and some text. When entering editing mode, I would like the image to fade out & move offscre开发者_JAVA百科en to the left. When & how do I implement this code? I tried putting an animation block in willTransitionToState: but the image simply jumps offscreen w/ no animation.


Override setEditing:animated: to do this type of thing. Make sure you don't animate if animated is NO. Like so:

if( animated ) {
    [UIView beginAnimations:@"EnterEditingMode" context:NULL];
    // Set up duration, etc here
}

if( editing ) {
    // do animation
} else {
    // reverse animation
}

if( animated ) {
    [UIView commitAnimations];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消