Basically I have a compound view in my storyboard:
UIView
with inputs. Let's call it View1
tableView
controller (View2)Works fine.
I have a small issue when another displayed tableview
from UIView
overlaps the bottom View2 with its own results. Only cells that stays within the bound of the View1 can be interacted with and selected. The part of the tableView
(autocomplete results) that actually overlaps View2 (and it looks like it is on top) scrolls the View2..
I already tried referencing View1 and setting View1.layer.zPosition
to a higher value. It wouldn't help..
Any suggestions?
If this requires modifying the code Swift syntax is preferred over obj-c
To be precise, table views and collection views are also scroll views. If you look at the documentation of the UITableView class, you will see that it descends from UIScrollView.
To scroll to the top of our tableview we need to create a new IndexPath . This index path has two arguments, row and section . All we want to do is scroll to the top of the table view, therefore we pass 0 for the row argument and 0 for the section argument. UITableView has the scrollToRow method built in.
A table view displays a single column of vertically scrolling content, divided into rows and sections. Each row of a table displays a single piece of information related to your app.
Your problem comes from the fact that the tableview with the autocomplete results is added to view1. And so it only receive touches sent to it. If you select clipSubviews on the view1 you'll see that your autocomplete results tableView will be cut to the bounds of the view1 1.
Try to add the autocomplete results tableView to the self.view(main view of the View Controller). This way it will be above both view1 and view2 and it will receive all the touches that come on this tableview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With