I want to enable scrolling in our scroll view. I have created an app using scrollview and set an image. using this code:
UIImageView *imgView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wall-1.jpg"]];
scrollview.scrollEnabled=YES;
[scrollview addSubview:imgView];
In the above code I also set scrollEnabled property to YES using scrollview outlet, but scrolling is not working.
Please suggest me how can I enable the scrolling feature in our application.
Thanks.
Your code is correct but needed one thing more to do. To enable scrolling in your scrollview, set the content size of scrollview and your problem will be solved.
Below I am providing complete code, in that code I have added one extra line of code:
That's it. after using above code you will see scrolling functionality is enabled now.
Now I want to tell you that you called a method scrollEnabled, there is no need to set this here, without using this scrolling will work perfectly.