Getting didSelectRowAtIndexpath method called when textfield inside custom table view cell is focused
I have a custom tableviewcell with a label and a textfield. Right now I get callback in method didSelectRowAtIndexpath only when user click开发者_Python百科s on cell outside of my textfield. When I touch on textfield this method is not called. So what should I do to get that method called when user touches on the textfield.
You want to read into UITextFieldDelegate and more specifically
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
and
- (void)textFieldDidBeginEditing:(UITextField *)textField
when those get called you can then do this on your UITableView
– selectRowAtIndexPath:animated:scrollPosition:
In cellForRowAtIndexPath method write
cell2.selectionStyle=UITableViewCellSelectionStyleNone;
for that row only
精彩评论