I’m using the following code in xCode, to work out how much to initially zoom on a UIImage in a scroll view but it keeps returning zero.
int heightRatio = self.scrollView.bounds.size.height / self.imageView.image.size.height;
The strange thing is if I do a subtraction it works, just not with division.
XCode describes both height variables as a “GLuint”, some graphics version of int I think.
I’ve NSLogged both numbers on the right, and neither are zero.
I’ve tried defining heightRatio as a GLuint as well, with no joy, and also converting to NSNumber but it’s all just getting a bit messy.
Am I missing something?
Thanks for any feedback.
You should declare
heightRatioas adouble(and round later if you want to have anint).