In my Ipad app, I have a split view in which the detail view is a scroll view…
I have 3 subviews to the scrollview which are tableviews…
How do I use - (void)bringSubviewToFront:(UIView *)view to bring one of the subviews of the scrollview to the front when an action is performed? (since Views are “stacked” in the order they’re added with the last one on top). Should I write the code in the subview or in the detailViewController and how do I call it?
In my Ipad app, I have a split view in which the detail view
Share
You write the code in the controller.
The controller should have access to the table views through
IBOutletproperties. Or, if you didn’t set them up using a nib, the controller should have been the one to create them.If a button tap, for example, is responsible for showing a particular table view, the button’s action handler method is where you call the
bringSubviewToFront:method.HOWEVER: It sounds like you have three table views on top of each other and are using
bringSubviewToFront:to show the current one, and they are all inside a UIScrollView.Each UITableView contains a UIScrollView. Don’t put a scrollview inside a scrollview, they will fight over tracking touches and things will get weird. Just put the three table views inside a plain UIView.
Instead of bringSubviewToFront:, you ought to consider hiding the inactive views (call
setHidden:). That way, the hidden views won’t be considered part of the responder chain (won’t get sent events).