How to create a simple scroll view when clicking a button in Xcode?
I have assigned the button and gave IBAction
as press,
what to code to make a scroll view on this action?
-(IBAction)press
{
}
How to create a simple scroll view when clicking a button in Xcode?
I have assigned the button and gave IBAction
as press,
what to code to make a scroll view on this action?
-(IBAction)press
{
}
In .h
file you must add delegate definition to your class declaration - something like this:
@interface someClass : NSObject <UIScrollViewDelegate>
In .m
write somethink like this:
-(IBAction)press
{
UIScrollView *_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
_scrollView.backgroundColor = [UIColor clearColor];
_scrollView.userInteractionEnabled = YES;
_scrollView.delegate = nil;
[self.view addSubview:self.scrollView];
}
That's all! :)