Custom UITableViewCell with parameter drawRect + normal blue

I have a custom UITableViewCell. All drawings are executed in the drawRect: method and no additional views are added. The drawing works great and the scroll speed is good. But the problem is with the selected cells. I want the choice to behave as usual:

  • Blue Gradient Color
  • inverted text color
  • Animated Removal

I could not reach all three.

First try:
Set selectionStyle = UITableViewCellSelectionStyleNone and make the selection color in the drawRect method. With this method, I can achieve the first two things, but the cancellation will be instantaneous. Thus, within one second it is selected in blue, and in the next second it is canceled. I do not get a pleasant fading.

Second attempt:
selectionStyle = UITableViewCellSelectionStyleBlue With this method, my cell is blue if selected. The text that I have is not displayed. However, fading out works.

:
selectionStyle = UITableViewCellSelectionStyleBlue, selectedBackgroundView UIView, backgroundColor . , selectedBackgroundView ( ) . , selectedBackgroundView , . , , "" .

?

+1
2

OK. ... UITableViewCell . UIImageView UIView.

, :
http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

+2

. , , , ( x x).

:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if (touch.view isKindOfClass:[UIButton class]]) {
        //do something with that view, for example: 
        //change the color of the text in that view, 
        //or invert it ;)
        return YES;
    }
    return NO;
}

, UIGestureRecognizer. , , .

, , . , 2/3 , 3/3.

0

All Articles