I've added a scrollview with a content size that is larger than the screen size in my view controller using storyboard. Of course the purpose of the scrollview is to have content larger than the view that contains it. I would like to add buttons and label to the bottom of the scrollview graphically in storyboard, but I can't view that part of the scrollview. How do I get there. I tried adjusting in the size inspector which worked for me when I first added the view a few weeks ago, but it don't let me change anything.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
You can work on iPad Full Screen size if your content won't exceed the screen size too much.
It's great that you solved that. If I had that problem I would create a view that has the same frame size as content size of the scroll view. Add all the controls I need (buttons, labels, textFields etc.) on this view at the positions I need. After that just added the view on scroll, make an IBOutlet of the scroll and set it's content size programmatically somewhere in my code, before using that scroll (setting it in viewDidLoad will be fine).
That's another solution of this problem.
The only way I've been able to edit my content in a
UIScrollView
(and this dates back to way before the Storyboard, but I'm pretty sure it still applies) is to change the offset of the x or y of your content frame.Another option, depending on whether your content view is "static" (built in the .xib) or not, is to actually pull it outside of the scroll view, and set it as the content view programmatically in
viewDidLoad
or something.Hope this helps, I can follow up with code examples if it makes sense and you need 'em.
EDIT (2/10/2012): Here's an example of how to hook up the larger view to your scroll view. In this example, the scroll view (scrollView) is set to the view controller's view property. In the .xib I've also added a
UIView
named largerView. The two are not hooked up in any way in the .xib file, they just both appear there.Given...
In
viewDidLoad:
we just...This is probably the simplest possible example though. Good luck!
@T.J. & @livingtech:
Why don't you use embed property given in Interface Builder?
Here you are creating two views (UIView largeView and UIScrollView scrollView). So its kind of wasting of memory for the same objects.
This would be easier for the code reusability and expandability purpose. If in future you need to add more objects.