Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image from camera is not immediately able to be moved. #36

Open
joeboyscout04 opened this issue Oct 28, 2013 · 4 comments
Open

Image from camera is not immediately able to be moved. #36

joeboyscout04 opened this issue Oct 28, 2013 · 4 comments

Comments

@joeboyscout04
Copy link

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.

@micnguyen
Copy link

Wow, both great fixes! Exactly the 2 problems that I had, wonderful mate. Thanks!

@micnguyen
Copy link

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 ?

@joeboyscout04
Copy link
Author

I noticed that issue also but was unable to come up with a fix for it in a timely manner. Good luck!

@micnguyen
Copy link

@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];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants