Search code examples
ipadios5uitableview

Blink or highlight multiple UITableView cells


Current situation: I have implemented drag-and-drop functionality feature where users can drag items from one place and drop on any allowed row in UITableView. For example, users can drag item and dropped only on first cell or first 3 cells. Other cells are invalid. This is working fine.

Question: With my implementation users are confused about where to drop item. I want to blink or highlight all cells where users can drop an item on demand(I mean first 3 cells would start blinking or highlighted when user has item to drop). In short is there anyway I can manually blink multiple cells whenever required and reset them to their original state later on.


Solution

  • I would suggest you to implement a blinking effect to the cell or its contentView in this case. In an animation block, you need to switch the alpha using a timer. You can get a sample code from this question which you can modify to put it in a timer and to apply on your cell.

    [UIView transitionWithView:cell.contentView
           duration:0.6f
           options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse
           animations:^{ cell.contentView.layer.alpha = 0.4f; }
           completion:NULL];