gekitz / GKImagePicker

Enables a custom crop rect for UIImagePickerController
MIT License
592 stars 176 forks source link

Wrong item placement in iOS4.3 (iPad) #2

Open jstuth opened 12 years ago

jstuth commented 12 years ago

Hey there,

first of all, very nice work!! Your custom cropview for UIImagePicker was excactly what i was searching for! I tested it in iOS5+ and everything works just fine! But when i run your GKImagePicker on iOS4.3 in iPad simulator, all items are placed in the lower right corner of the popover. I figured out, that you use "self.view.bounds" for any size depending calculations. But this seem not be set properly in iOS4.3 when setting the "contentSizeForViewInPopover" property. By setting the view bounds properly everything is shown perfect, but i'm impossible to scale and move the image. Can you confirm this issue? It would be nice if you could fix that.

kind regards

gekitz commented 12 years ago

I will take a look at this issue next week. Will let you know the outcome of my investigations.

jstuth commented 12 years ago

Interesstig.... In iOS 4.x the layoutSubviews method is called each time you scale or move the image in the UIScrollView. So everytime i try to scale my image, it is resized and centred in the UIScrollView. In iOS 5.x the layoutSubviews method is just called once. Weird behaviour....

jstuth commented 12 years ago

ok, i fixed it in a quick and dirty way. i added this line:

self.view.bounds = CGRectMake(0, 0, self.contentSizeForViewInPopover.width, self.contentSizeForViewInPopover.height-self.navigationController.navigationBar.frame.size.height);

to the "viewDidLoad" method in the GKImageCropViewController class. This places the items to the correct position in the view.

To be able to scale and move, i added a boolean value which prevents multiple calls to "layoutSubviews" in the GKImageCropView class.

this worked for me from iOS 5.x down to iOS 4.0. maybe you have a better idea to fix this issue, but this quick and dirty approach helps me for now.