Hi,
I'm currently trying to center a PDF in a UIView but having no luck.
1. I have a UIView that is 138.24 x 184.32 (1024 x 768 * .18)
2. My PDF is 612 x 939
3. I am scaling the PDF to fit the 1024 x 768 (a home rolled scale to fit calculation proportionally)
4. Im calling the scaleCTX(.18,.18 * -1);
5. Im calling the transformCTX(0,PDFHeight * -1)
My problem is that I can't figure out the calculation necessary to center the pdf in the UIView. I have hardcoded the values to move the PDF to center but there doesn't seem to be any consistency to do this dynamically. I have tried taking the result of subtracting the (PDFwidth - frame width) / 2 but this doesn't do the trick...so Im lost on how to center the PDF.
Any suggestions would be greatly appreciated.
Thanks,
Ron
I'm currently trying to center a PDF in a UIView but having no luck.
1. I have a UIView that is 138.24 x 184.32 (1024 x 768 * .18)
2. My PDF is 612 x 939
3. I am scaling the PDF to fit the 1024 x 768 (a home rolled scale to fit calculation proportionally)
4. Im calling the scaleCTX(.18,.18 * -1);
5. Im calling the transformCTX(0,PDFHeight * -1)
My problem is that I can't figure out the calculation necessary to center the pdf in the UIView. I have hardcoded the values to move the PDF to center but there doesn't seem to be any consistency to do this dynamically. I have tried taking the result of subtracting the (PDFwidth - frame width) / 2 but this doesn't do the trick...so Im lost on how to center the PDF.
Any suggestions would be greatly appreciated.
Thanks,
Ron