Question

I am new to iOS Development and am wondering how to put a scrollview in a storyboard, using Xcode 4.2. I want the content to be 1280 by 460. This code all works well, but when I go to wire up the outlet, there is no file's owner, so i'm stumped. Here is the code I have:

in the .h file-

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {
IBOutlet UIScrollView *scrollView;

}

@end

and the .m, under viewDidLoad:

- (void)viewDidLoad
{
    [scrollView setScrollEnabled:YES];
    [scrollView setContentSize:CGSizeMake(1280,460)];
    [scrollView setPagingEnabled:YES];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

If anyone could help me, that would be great!

Was it helpful?

Solution

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.

OTHER TIPS

OK, I figured it out. I just had to create a class for my view controller. I was trying to use files that were not part of a class that was a subclass of UIViewController.I had to create a new class, then copy the old code in and make my view controller's class that of the NEW files, and THEN wire up the outlets. I was changing the class to something that was not there. I then wired my outlet up to the scroll view I wanted. Thankfully, that part is finally over! Thanks for the suggestions, guys, I really appreciate it.

A good visual tutorial is in the current Stanford CS193p course for iOS 5 in iTunes U. This course works mainly with storyboards and they cover among other things UIScrollViews

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top