Okay, so i'm using a UIScrollView in my app. I have placed the scrollview in a viewcontroller in story board. I have several buttons there and a few labels. But when I try to scroll down to the buttons at the bottom, the scrollview just bounces back to the top. This is the code I have used:
In viewcontroller.h:
@interface ViewController : UIViewController{
IBOutlet UIScrollView *hovscroll;
}
@end
In viewcontroller.m:
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[hovscroll setScrollEnabled:YES];
[hovscroll setContentSize:CGSizeMake(320, 1500) ];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end
You need to disable paging. There are (at least) two ways of doing this:
In the storyboard, select the UIScrollView component, and un-tick "Paging Enabled" in the "Attributes Inspector."
In the code, by using:
scrollView.pagingEnabled = FALSE;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With