Designing Inside a Scrollview in Xcode 4.2 with Storyboards

Designing inside a scrollview in xcode 4.2 with storyboards

I feel your pain. The only way I found is to manually pan the scroll view in the size inspector to reveal the portion of the view that you wish to visually edit.

Use a UIView to contain elements so they are positioned relatively to this view. Add the view as a subview to the scrollview at 0,0.

  1. pan: use the Y coordinate say to -200, then edit the contents.
  2. to place more contents in the hidden part, pan again to reveal new real-estate
  3. when finished, restore the values of the ScrollView's height and X,Y position.

Make sure the scroll view frame rectangle is smaller than the contained view.

Is there a tutorial somewhere about designing a really large view and put it in scrollView using storyboard

I don't think you can get a tutorial on this as it is simply impossible in IB. As most people already commented out what you want to do here need to be done programmatically.

If you are using XIB you can set up all your content there. Under the size tab (in the inspector) you will need to change the height to fill all your content but you still need to set up your contentSize programmatically.

For storyboard I don't think it is possible to change the size of your scrollview in IB.

How to make UIScrollview with xCode 4.2 and storyboards

Storyboards do not have a File's Owner. You need to use the View Controller to connect the Outlets instead. I.E. Drag to the View Controller in the same way you used to drag to the File's Owner.

View behind ScrollView or not? And how to do so with storyboard

Because view objects are the main way your application interacts with the user, they have a number of responsibilities. Here are just a few:

Drawing and animation

Views draw content in their rectangular area using technologies such as UIKit, Core Graphics, and OpenGL ES.
Some view properties can be animated to new values.

Layout and subview management

A view may contain zero or more subviews.
Each view defines its own default resizing behavior in relation to its parent view.
A view can manually change the size and position of its subviews as needed.

Event handling

A view is a responder and can handle touch events and other events defined by the UIResponder class.
Views can use the addGestureRecognizer: method to install gesture recognizers to handle common gestures.

If you decided to use UIScrollView instead of UIView than you can not override these methods incase if you are in need in future for that same application.

I hope my answer helps you to understand the need of UIView .

Here is a very nice tutorial which will guide you.
ScrollView Example in iPhone

Here is another very nice tutorial along with Story Board.
How To Use UIScrollView to Scroll

Thanks :)



Related Topics



Leave a reply



Submit