Search code examples
iosuitableviewxamarin.ioshittest

After send subview to back in uitableview, how to touch the subview?


I use a headerview as a UITableView subview, now I want to dynamic hide some view in the headerview. My solution is send the headerview to back of the UITableView and update the contentoffset of the UITableView.

Like this:(before) The red rectangle is the headerview and the green one is the hiddenview.

enter image description here

(after)

enter image description here

But I can not touch button, textfield etc now. I have tried the hittest and pointinside methods, but it did not work. Maybe I use the wrong way. So anybody can help me? Thanks.


Solution

  • Hide subviews using headerview.subview.hidden = YES and updateConstraints if you are using auto layout otherwise update frame.