How do I best position an image (UIImageView) within a UIScrollView programmatically?
I have the x and y coordinates (CGPoint C = centerCoordinate) of the image position that needs to be centered horizontally and vertically in the UIScrollView.
===Image=============================================
| |
| |
| ==ScrollView=== |
| | | |
| | C | |
| | | |
| =============== |
| |
| |
| |
| |
=====================================================
I tried a) working with the center property of the ImageView, but don't seem to make progress here. b) then I tried calculating the frame-property by setting the origin to
C.x = -1 * centerCoordinate.x + ScrollView.frame.size.width / 2
C.y = -1 * centerCoordinate.y + ScrollView.frame.size.width / 2
but don't succeed.
any hints?
regards