How to highlight a UIButton subclass?

后端 未结 2 407
予麋鹿
予麋鹿 2021-01-29 01:33

I have a subclass of UIButton where I overwrite drawRect for a custom looking button.

But now the cell doesn\'t highlight.

How can I f

2条回答
  •  鱼传尺愫
    2021-01-29 01:49

    i think you can deal with the highlight problem with these methods below

    - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event;
    - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event;
    - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event;
    - (void)cancelTrackingWithEvent:(UIEvent *)event;
    

    you can change the color or the image in these method

提交回复
热议问题