Designing inside a scrollview in xcode 4.2 with storyboards

前端 未结 9 810
梦如初夏
梦如初夏 2020-11-29 02:46

I have a vertically scrolling uiscrollview - imagine an \'about this app\' page of a tab bar app which goes on a bit and requires a scrollview. It only contains a few images

相关标签:
9条回答
  • 2020-11-29 03:36

    Here's my solution to design a ScrollView with a content larger than the screen entirely in Storyboard (well, except for 1 single line of code :-) :

    https://stackoverflow.com/a/19476991/1869369

    0 讨论(0)
  • 2020-11-29 03:40

    On iOS 6.0 you can drag a Container View inside your Scroll View. This will automatically create a new View for your content, outside of the current scene. You can then resize this view as big as needed to fit your content.

    I believe you would still have to set the ScrollView content height at runtime, but at least you can design you content view at once without having to scroll up and down on IB.

    0 讨论(0)
  • 2020-11-29 03:43

    I'm currently developing an app for iOS 7, and I did exactly as @Dickey Singh's answer, but it doesn't work in the beginning. After checking the storyboard, I found that we also need to add Auto Layout Constraints for the view controller who holds the scrollView. It seems that such auto layout constraints would be added automatically before Xcode 5, but now we need to do it ourselves. The way to add constraints: First select the view controller in the storyboard; Enter 'Editor' in the top menu; Select the 'Resolve Auto Layout Issues'; Select the 'Add Missing Constraints In Container'. Done :-)

    0 讨论(0)
提交回复
热议问题