I'm in the midst of trying to use a UIScrollView and there appears to be some fundamental thing that I'm just not understanding.
Let's say I want to use a UIScrollView in my iphone app. I have a View filled with buttons that is 320x700. Obviously, this is too big for the iPhone which is 320x480. So I know I have to use a UIScrollView. However, is this the order that I should be creating the objects
- Create a UIScrollView that is 320x700 as the dimensions in "View"
- Place all my buttons, etc, on this scroll view
- In the viewDidLoad set the contentSize to 320x700
- Set the delegate of the UIScrollView to the File Owner, and the view of the FileOwner to the UIScrollView
- Reset the size of the View back to 320x480.
Is this right?
This works, but it doesn't make sense to me. I get that the View is supposed to be the canvas, where I add all the UI elements. I want the "canvas" of the iPhone app to be 320x700, and I want to be able to put my buttons, etc on this 320x700 canvas. But if I don't change the size of the UIScrollView back to 320x480, it won't scroll, because I need to set the content size of the UIScrollView larger than its size.
But if I set the size of the UIScrollView to 320x480, then I don't see the screen and the buttons between 480 and 700 in Interface Builder! So it seems like I'm supposed to make all my edits and add all my UI elements to the UIScrollView, and then set it back to the 320x480!
Is there some other way to do this that makes more sense? What am I missing in my understanding of how this should work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…