触地得分iphone上的hightlight自定义绘制单元格 [英] hightlight custom-drawn cell on touchdown iphone

查看:121
本文介绍了触地得分iphone上的hightlight自定义绘制单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是自定义绘图单元格,如何在触地时高亮显示单元格

I am custom drawing cells, how can I hightlight the cells on touchdown

谢谢

推荐答案

UITableViewCell有两个被调用的方法:

The UITableViewCell has two methods that get called:

- (void) setHighlighted:(BOOL)highlighted

- (void) setSelected:(BOOL)selected

基本上setHighlighted在触摸时调用(并在触摸时取消设置),而setSelected在选择卡住(用户意图按下单元格)时调用。如果您使用普通的表格视图和单元格组合,您会发现当您滚动它们时,单元格可以短暂突出显示并且不会突出显示。

Basically setHighlighted gets called on touch down (and unset on touch up) whereas setSelected gets calls when the selection is "stuck" (the user meant to press the cell). If you play around with a normal table view and cell combo, you'll notice that the cells can highlight briefly and unhighlight when you scroll away from them.

要突出显示背景,如果您使用drawRect中的自定义背景填充,您可以更改它的颜色并调用setHighlighted中的setNeedsDisplay以强制重绘使用您的新背景。

To highlight the background, if you are using a custom background fill in drawRect you can change the color of that and call setNeedsDisplay in setHighlighted to make it force a redraw using your new background.

这篇关于触地得分iphone上的hightlight自定义绘制单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆