0

How would you use tableView:didDeselectRowAtIndexPath: to trigger textFieldShouldBeginEditing: ?

Or what other options do I have? I did consider having tableView:didDeselectRowAtIndexPath: trigger a UIAlertView (with textField) but it isn't aesthetically pleasing.

Can
  • 8,502
  • 48
  • 57
Brian
  • 73
  • 2
  • 11
  • Check out - http://blog.spritebandits.com/2012/03/13/creating-custom-uitableviewcells-from-xibs-step-by-step-tutorial/ and http://zeroheroblog.com/ios/how-to-create-simple-tableview-with-custom-cells – βhargavḯ Jul 23 '13 at 04:24

2 Answers2

1

Your question is a little light on details: what's the user interface look like? What are you tying to accomplish?

To literally answer your question, you can just have didDeselectRowAtIndexPath implementation call the method textFieldShouldBeginEditing - however I don't believe that's what you're asking? What it sounds like you're asking is how you can get a touch event on a table view cell to pass into a UITextField so that editing begins.

That would make this a duplicate of other questions already asked here: Having a UITextField in a UITableViewCell

Community
  • 1
  • 1
Matt S.
  • 1,882
  • 13
  • 17
0

Not sure how proper the practice is, but I have an app I use a textField that is 1x1 points and off screen. If I want to bring up the keyboard, I call

[self.myTextField becomeFirstResponder];

Then you can use the UITextFieldDelegate methods to control and update information being entered on the keyboard.

Then when the user is done, I call

[self.myTextField resignFirstResponder];

Of course this is assuming that you don't actually want to use a textField in your tableView.

Hope this helps.

Jamie
  • 5,090
  • 28
  • 26