显示删除线动画的最佳方式是什么?当用户在 UITableViewCell 上滑动手指时,我想为一条细线制作动画cell.textlabel.text
到目前为止我想到的两种方法是使用动画或以某种方式显示自定义图像并从左到右缓慢地显示它?有人对此有什么建议吗?
我已经有了滑动手势,我现在只需要知道如何制作动画:
添加手势识别器:
//Add a left swipe gesture recognizer
UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSwipeLeft:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
[self.tableView addGestureRecognizer:recognizer];
//Add a right swipe gesture recognizer
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSwipeRight:)];
recognizer.delegate = self;
[recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[self.tableView addGestureRecognizer:recognizer];
手势的委托方法:
- (void)handleSwipeLeft:(UISwipeGestureRecognizer *)gestureRecognizer
{
NSLog(@"uncompleted");
}
// Cross Item off of the list
- (void)handleSwipeRight:(UISwipeGestureRecognizer *)gestureRecognizer
{
NSLog(@"completed");
}