Darshan Prajapati
Darshan Prajapati

Reputation: 843

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 clicks 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.

Upvotes: 1

Views: 994

Answers (2)

tsakoyan
tsakoyan

Reputation: 1891

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:

Upvotes: 2

dks1725
dks1725

Reputation: 1631


In cellForRowAtIndexPath method write

cell2.selectionStyle=UITableViewCellSelectionStyleNone;

for that row only

Upvotes: 1

Related Questions