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

Not positioning correctly in UIScrollView when using negative contentOffset (e.g. pull-to-refresh) #5

Open
koloritcm opened this issue Jun 4, 2013 · 3 comments

Comments

@koloritcm
Copy link

Here
https://github.com/kolyvan/kxmenu/blob/master/Source/KxMenu.m#L323
KxMenuOverlay *overlay = [[KxMenuOverlay alloc] initWithFrame:view.bounds];

view.bounds has y negative during pull-to-refresh and therefore the menu is shown the height of the pull-to-refresh area too high. Its correct in that way that it covers the whole screen with the overlay so you can click everywhere to dismiss, but the actual menu will be displaced.

The solution if you don't care that the pull-to-refresh area will not be part of the dismiss area is this instead:

``KxMenuOverlay *overlay = [[KxMenuOverlay alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];`

Or if you want the whole area to be dismiss area you can adjust the supplied rect for contentOffset (here: https://github.com/kolyvan/kxmenu/blob/master/Source/KxMenu.m#L316):

if([view isKindOfClass:[UIScrollView class]]) rect = CGRectMake(rect.origin.x, rect.origin.y-((UIScrollView*)view).contentOffset.y, rect.size.width, rect.size.height);

@kolyvan
Copy link
Owner

kolyvan commented Jun 6, 2013

HI, thanks for your proposal.

First, this code

KxMenuOverlay *overlay = [[KxMenuOverlay alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];

will not work correct in landscape mode.

For if([view isKindOfClass:[UIScrollView class]]), imho, the better solution for avoid problem with scroll view: use a superview of scrollview for showing kxmenu.

@koloritcm
Copy link
Author

@kolyvan Why is it different in landscape mode? How could you use a superview of UIScrollView if you want to be able to scroll?

@longzihang
Copy link

thanks

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

3 participants