GKImagePicker
GKImagePicker copied to clipboard
Image from camera is not immediately able to be moved.
Seems like when you take an image with the camera, you cannot move it (pan it) immediately. If you zoom in a bit, the image is then able to be panned. I think this is tied to an issue with the content size, I corrected by using the faktored width and height.
In addition there was an issue where the image was positioned not exactly in the correct spot, fixed by setting the contentOffset.
in GKImageCropView.m
-
(void)layoutSubviews{ //some code here...
self.cropOverlayView.frame = self.bounds; //JJE - explicitly specify the content offset here to ensure there isn't a gap. self.scrollView.contentOffset = CGPointMake(0,0); self.scrollView.frame = CGRectMake(xOffset, yOffset, size.width, size.height); //JJE - changed the contentsize to the new width and height so we can move it immediately self.scrollView.contentSize = CGSizeMake(faktoredWidth, faktoredHeight); self.imageView.frame = CGRectMake(0, floor((size.height - faktoredHeight) * 0.5), faktoredWidth, faktoredHeight); }
I've got some other custom mods to this I can share.
Wow, both great fixes! Exactly the 2 problems that I had, wonderful mate. Thanks!
Just updating this (posting another comment for more visibility):
The 2nd fix, to position the image in the proper position to remove the black bar at the top between the crop frame and the image itself works - but when you drag the image down as much as you can, and have the image bounce back up, then the image doesn't bounce back up all the way and returns to a position with the black bar.
Any idea @joeboyscout04 ?
I noticed that issue also but was unable to come up with a fix for it in a timely manner. Good luck!
@joeboyscout04
Found the issue - the status bar screws up the frame. That explains why this problem only occurs when the image source is from the Library and not Camera (because opening the camera hides the status bar), and also why the problem only occurs at the top of the image.
To fix it, add the following line in GKImagePicker.m:
[[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationFade];