问题
I have a UIScrollView that contains a UIToolbar, but when I scroll, the toolbar scrolls as well, separating from the bottom of the screen. Is there a way to make the toolbar stick to the bottom of the screen as the scroll happens?
I tried to create a view that contained both the ScrollView and the Toolbar, but when the program runs, the ScrollView is all that I can see. This problem could be due to the ScrollView being drawn on top of the toolbar, but I'm not sure.
Any help in either of these two methods (or even a third that I haven't thought of yet) would be greatly appreciated.
Thanks,
Chris
回答1:
If you're using the interface builder, you can simply re-size the UIScrollView so that it sits above where the UIToolbar will be placed. (Place the UIToolbar first and the UIScrollView will most likely snap to use the available space.)
If you're adding the UIToolbar programmatically, you can allow for its presence by selecting the "Toolbar" option under "Bottom Bar" within the Simulated Metrics section of the attributes inspector.
来源:https://stackoverflow.com/questions/5760467/how-can-i-pin-a-uitoolbar-to-the-bottom-of-the-screen-in-a-uiscrollview