I’m trying to use the following code to move through pages of a Pdf using webView.
float Y = pdfNavigateController.webView.center.y + gY;
[pdfNavigateController.webView.scrollView setContentOffset:CGPointMake(0,Y)];
The value gY is also a float and is incremented as the user selects the next page. The code is currently throwing an error ‘Invalid operands to binary expression (‘CGFloat’ (aka ‘float’) and ‘float *’). I’m guessing the operands are invalid as the value is a pointer but I don’t know how to pass the incremented value without getting this error.
If gY is a pointer (to a float), you need to dereference it in order to access its value:
EDIT
Make sure you’ve got a valid pointer (i.e., gY points to an actual float).
If it’s an un-initialized pointer, it won’t work.
Can you please tell us how do you get
gY?EDIT 2
I’ve seen you said that gY is declared as:
That’s a NULL pointer.
And you can’t dereference a NULL pointer.
When you increment it, you increment the pointer (the memory address), not the value.
So your pointer actually points to garbage.
Why do you use a pointer?
You should use: