ARC, iOS 5, XCode 4.2
I am trying to implement a paged scroll view with a page control (similar to the Home screen), and I can't seem to get it to work. The relevant code is:
- (void)viewDidLoad
{
[super viewDidLoad];
[scroll setDelegate:self];
[scroll setContentSize:CGSizeMake(2 * [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
[scroll setPagingEnabled:YES];
pageControl.currentPage = 0;
pageControl.numberOfPages = 2;
UIView* view = [[self.storyboard instantiateViewControllerWithIdentifier:@"VALID_ID_1"] view];
view.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height);
[scroll addSubview:view];
UIView *aView = [[self.storyboard instantiateViewControllerWithIdentifier:@"VALID_ID_2"] view];
aView.frame = CGRectMake([[UIScreen mainScreen] bounds].size.width, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height);
[scroll addSubview:aView];
}
Calling the instantiateViewControllerWithIdentifier
method returns a result.
Things I have tried:
- Disabling ARC on this particular file
- Using
alloc] init]
on the view controller
EDIT: I should probably show the declaration:
//MyViewController.h
@property (strong, nonatomic) IBOutlet UIScrollView* scroll;
...
//MyViewController.m
@synthesize scroll;