Question

So, I'm making a scroll up and a scroll down button on a UIWebView. Ideally, the user will have the option to scroll through it with their finger, or by tapping the button. Like when they tap the button, it will scroll down an inch or so. This is the code I'm working with (thanks to danypata):

    //Scroll Up:
-(IBAction)scrollContentUp:(id)sender {

    [_viewWeb.scrollView setContentOffset:_viewWeb.scrollView.contentOffset.y - 10.0 animated:YES];
}

//Scroll down:
-(IBAction)scrollContentDown:(id)sender {
    [_viewWeb.scrollView setContentOffset:_viewWeb.scrollView.contentOffset.y + 10.0 animated:YES];
}

The issue lies with the 10.0. I'm getting the error: Sending double to parameter of incompatible type CGPoint (aka struct CGPoint)

I've never worked with CGPoints before, and have tried researching them but it goes way o ver my head. Does anyone know what to plug into this code to achieve the scroll effect?

Was it helpful?

Solution

In your code you are passing float value in the place ofCGpPoint that's why you are getting that error. set CGPointMake(x,y) value for contentOffset value.

[_viewWeb.scrollView setContentOffset:CGPointMake(0,_viewWeb.scrollView.contentOffset.y - 10.0) animated:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top