0

Possible Duplicate:
UITableView and keyboard scrolling issue

In have a UIView with in that I have its subview UITableView and on UITableViewCells I have UITextView where user can enter a text, now i want to get the POSITION of that UITextView which is currently tapped by user.

UIToucheBegan is not calling on subviews of a UIView means from UITableView.

Community
  • 1
  • 1
ganesh manoj
  • 977
  • 10
  • 24

3 Answers3

1

What you can do is:

  1. Set your view controller as the UITextView delegate.
  2. When editing begins, loop through the UITextView superviews until you find UITableViewCell.
  3. Use the UITableViewCell frame property to determine its position (in conjunction with UITableView.contentOffset, UITableView.frame and your main container UIView.frame) to get the position of the UITextView relative the UIView (or whichever view you wanted).

or

  1. Add a tap gesture recognizer to the UITableView.
  2. In the target method, use [tapGestureRecognizer locationInView:myTableView] to get the tap relative the UITableView content.
  3. Use the UITableView indexPathForRowAtPoint: method and then the cellForRowAtIndexPath: to get the UITableViewCell. From there, do (3) above.
Anton
  • 3,998
  • 25
  • 40
0

try add tag to the textField in your cellForRowAtIndexPath method

and then in method which is calling when user start typing in UITextField look for sender.tag

or... may be it would be better to make CustomCell for this

Roma
  • 1,107
  • 9
  • 19
0

Subclass UITableView and then implement touchesBegan in that subclass if you want touches on tableview

Vishal Singh
  • 4,400
  • 4
  • 27
  • 43