ios - Trying to get number of row and section of a text field in a cell -


i've grouped uitableview several custom cells placed text fields. have defined property pointing text field active:

- (void)textfielddidbeginediting:(uitextfield *)textfield {    self.activetextfield = textfield; }  - (void)textfielddidendediting:(uitextfield *)textfield {    self.activetextfield = nil; } 

i need row , section of cell containing such text field. tried this:

uitableviewcell *parentcell = (uitableviewcell *)[self.activetextfield superview]; nsindexpath* cellpath = [self.tableview indexpathforcell:parentcell]; nsinteger cellrow = [cellpath row]; 

but 0. looks parentcell not uitableviewcell (but should be). how can values?

thanks

if adding text view cell's container view have call self.activetextfield.superview.superview. if not, self.activetextfield.superview should work.

in order find out if text field added container view's cell:

  1. if add text field xib/storyboard custom cell in contentview
  2. if [cell addsubview:] in cell's view
  3. if [cell.cotentview addsubview:] in container view.

Comments