-1

I'd like to get parent view of UITextField on my user defined cell. What I've tried is just call superview method and it returns UIView, not a my cell view. So I invoked superview several times.

UITextField -> UIView -> UITableViewCellContentView -> MyCellView

There're two more unexpected view. What are those and WHY?

add desc.) I've made my own cell and there's an UITextField.

Hongseok Yoon
  • 3,148
  • 8
  • 36
  • 51
  • 1
    The UIView inside UITableViewCellContentView is created by your app (possibly by Interface Builder). The content view corresponds to the UITableViewCell.contentView property; it's there to assist in proper layout when your cell has an accessory view or editing control. – tc. Nov 21 '10 at 18:35

1 Answers1

0

A UITableViewCell have a contentView where the custom view s are added. you can run a loop until you get the MyCellView

View view = textView.superView;
while( ![view isKindOfClass: [MyCellView class]]){
  view = view.superView;
}

// now you get the view as MyCellView
karim
  • 15,408
  • 7
  • 58
  • 96