私は MCSwipeTableViewCell を使用しているので、ユーザーが左または右にスワイプしてアクションを完了するという考え方です。ただし、ユーザーは常にこのアクションに慣れているとは限らないため、セルをタップすると (セルを選択することを期待して)、テキストで短い指示を簡単に点滅させてから、元のテキストに戻ります。
私はこれを何日も続けてきましたが、運が悪くても戻ってきます。完了ブロックを使用して、遅延をいじってみましたが、アニメーションが非常に速く完了しているように見えますが、実際には変化が見られません。何が間違っていますか?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
MCSwipeTableViewCell *cell = (MCSwipeTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];
Station *station = self.recentStations[indexPath.row];
[UIView animateWithDuration:0.5 animations:^{
//code to fade the text out
CATransition *animation = [CATransition animation];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionFade;
animation.duration = 0.35;
[cell.textLabel.layer addAnimation:animation forKey:@"kCATransitionFade"];
//instructions to appear briefly
cell.textLabel.text = @"Swipe left to set alarm or right to remove";
//nested animation to revert text after a 1.5 second delay
[UIView animateWithDuration:.05 delay:1.5 options:UIViewAnimationOptionCurveEaseIn animations:^{
//code to fade the text back in
CATransition *animation = [CATransition animation];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionFade;
animation.duration = 0.35;
[cell.textLabel.layer addAnimation:animation forKey:@"kCATransitionFade"];
cell.textLabel.text = station.name;
} completion:nil];
}];
}