Just something I’d better remind next time I pick up with an application development. View controllers are the solid rocks on which everything is built and UIScrollView is easy to use only if you know how.
There are four main methods you’ll probably use:
In here you can init all of your data. View is not still loaded so if it’s unarchived from a NIB file all outlets are missing.
Here your view is loaded ONLY if it’s unarchived from a NIB file. It’s the right place to init all objects loaded from the NIB.
Here you NEED to create your view and assign it to the view controller (self.view= whatever) if it’s created programmatically and not loaded from a NIB.
Tables ? Edit field ? Here’s the place for setting the default values and loading data into tables. Remember: it’s called only if the view is not added directly to the view hierarchy. You must pass through the view controller. You know, things like pushNavigationController and so on.
And this is the right place to save the data you entered in edit fields and other controls to your model.
So you might use them like this:
NSSring *string=[[NSUserDefaults standardUserDefaults] stringForKey:@"MyString"];
[[NSUserDefaults standardUserDefaults] setObject: string forKey:@"MyString"];
In IB create a UIScrollView, drop inside each control and subview you need. Make sure the UIScrollView is big enough to contain all of your items.
In your ViewController.m in viewDidLoad or viewWillAppear (my first chance) write the following code:
The most important thing is that the content size must be bigger than the scrollview’s one. Without this excerpt no auto-scrolling !