Is there an easy way of putting a 'floating' button above a UIScrollView in Storyboard? I would like to add a lock button to toggle scrolling on and off. I guess I could do this in code but it would be nice if it could also be done via XCode.

有帮助吗?

解决方案

Just drag the button onto the view somewhere over your UIScrollView. Now, IB will automatically dump it in the scroll view, but you can move it out by using the object browser.

  • Open the object browser
  • Drag the button out to the same level as the UIScrollView
  • Ensure that the button is below the scroll view in the list (this means it's above the object in the view hierarchy)

You may have to use the inspector to set the button's actual location rather than dragging it around. Dragging it around for placement will most likely cause it to jump back into the scroll view.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top