I am trying to make a UIScrollView scrollable.As I’ve understood, the difference between the content size and the frame size makes the view scrollable to reach the other parts of the rectangle.So I’ve put different sizes.
This what I’ve done in my view controller:
- (void)viewDidLoad
{
[super viewDidLoad];
scrollView= [[UIScrollView alloc]initWithFrame: CGRectMake(0, 0, 200, 200)];
scrollView.contentSize= CGSizeMake(1000, 1000);
scrollView.scrollEnabled=YES;
scrollView.pagingEnabled=YES;
scrollView.backgroundColor=[UIColor yellowColor];
scrollView.alwaysBounceHorizontal=YES;
scrollView.alwaysBounceVertical=YES;
[self.view addSubview: scrollView];
}
But the view is not scrollable, the scroll bar isn’t even there is the view.
There are some similar questions but no one made me get the solution.
I got the impression that everything I write in the viewDidLoad method is merely ignored, except for setting the color.But of course the method gets executed.
I discovered that the view was scrolling, just in a different way from what I had habis with Cocoa so i didn’t notice it.