I have question for you ... I have UITableView and I want to catch event when user press the cell in order to change the color of label that I insert into UITableViewCell. The moment when user touch the cell.
functions didn't help me ...
Who have any suggestion ? Thanks a lot for help !!!
Subclass the UITableViewCell and override the UIResponder with these:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
Then you will have 2 separated events when press and when release.
If you want to change the color of a UILabel
inside a UITableViewCell
when it's selected, you don't have to do any sort of event catching. You just have to change the highlightedTextColor
property of the UILabel
. The default is usually white.
Did you set the delegate of the tableView?
Did your class conform to the UITableViewDelegate protocol?
Confirm With UITableViewDelegate
protocol and implement the methods which you mention,
Do'nt forget to set the delegate property of your UITableView
.
myTableView.delegate = self;
Have you looked at UILongPressGestureRecognizer? See: http://developer.apple.com/library/ios/#documentation/uikit/reference/UILongPressGestureRecognizer_Class/Reference/Reference.html%23//apple_ref/occ/cl/UILongPressGestureRecognizer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.