Question

I created a bunch of editable UITableViewCell by embedding an UITextField inside, but I have seen some apps that allows you to scroll the UItableview by scrolling inside an inactive editable cell. How can I do that? And how can I also dismiss the keyboard when tapping somewhere else? I know about the method:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        UITouch *touch = [[event allTouches] anyObject];
        if (touch.tapCount == 1) {
        [self resignFirstResponder];

        }
else {
    }}

I put it inside my custom table view controller but the method doesn't seem to be called upon a tap, and I don't know if even if it gets called will dismiss the keyboard.

Any help will be appreciated.

Was it helpful?

Solution

Ok, I found a way and I want to share it. I created a class for each cell so I set the UItextField userInteractionEnabled property to NO and in my custom table view controller I set the didSelectRowAtIndex Path to find in the tableview object the respective cell object based on the indexPath and set the userInteractionEnabled to YES. Now the problem is how to force the first responder resign of the cell if the user taps somewhere else in the table view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top