Skip to content

Instantly share code, notes, and snippets.

@djburdick
Created June 6, 2014 18:43
Show Gist options
  • Save djburdick/022c3f45172d003930ca to your computer and use it in GitHub Desktop.
Save djburdick/022c3f45172d003930ca to your computer and use it in GitHub Desktop.
Setup UIScrollView
1. embed content in uiview (select all and Editor -> Embed In)
2. embed that uiview in a uiscrollview
3. set uiscrollview size to phone screen size (eg: 320x568)
4. set uiview size to the size of the entire contest (eg: 320x900)
5. create property outlets for both uiview and uiscrollview
6. set the scrollview content size to the uiview size. self.scrollView.contentSize = self.contentView.bounds.size;
7. make sure the contentSize code is in - (void)viewDidAppear:(BOOL)animated (not in viewDidLoad)
or if in a navigation controller it must be in: viewDidLayoutSubviews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment