How to set a cross hair icon in exact middle of the camera overlay?
I would think MyImagePicker.frame.center is where I should place the icon (subtract icon.size.width/2 and height /2., but when t开发者_如何学Gohe picture actually saves, what I thought the cross hair is pointing at is not the middle of the image at all. X seems okay, but Y happens to be some distance off. I can approximate by trial and error, but I would like to be exact.
Help?
The frame
actually defines the origin and dimensions of the view in the coordinate system of its superview and is commonly used during layout to adjust the size or position of the view as detailed here.
You most likely want to use MyImagePicker.bounds.size.width / 2
and MyImagePicker.bounds.size.height / 2
to get the actual center of your image picker.
I actually learned this recently by watching the Stanford lecture series on iOS 5 development on iTunes U.
精彩评论