I have been trying to implement scroll view all day and watched as many as 30 tutorials (ok not that many but enough) and many text tutorials later but still won't work as everyone has different methods... I'm going insane here, can someone help? Here is the line of code that apparently works with scroll view... plus the steps I've taken:
created my second controller (named it View Controller2), dragged scroll view(named scroller) onto it and then started coding.
.h:
@interface ViewController2 : UIViewController {
IBOutlet UIScrollView *scroller;
}
@end
.m:
@implementation ViewController2
{
[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake(320, 600)];
[super viewDidLoad];
}
@end
I then after dragged the scroller from the attributes onto the UI scroll View and when I try running it I get errors with regards to the .m
code? I also put two buttons on the view controller one at the top and another at the bottom to see if it would scroll once I run it as the screen would then go from 4 inch to 3.5.
I just ran this and it compiles and runs without error (although it doesn't do anything of note):
.h:
@interface ViewController2 : UIViewController {
IBOutlet UIScrollView *scroller;
}
.m:
@implementation ViewController2
- (void)viewDidLoad
{
[super viewDidLoad];
scroller = [[UIScrollView alloc] init];
[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake(320, 600)];
}