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

Menu will scroll up together with table view #27

Open
ishunyu opened this issue Mar 17, 2014 · 3 comments
Open

Menu will scroll up together with table view #27

ishunyu opened this issue Mar 17, 2014 · 3 comments

Comments

@ishunyu
Copy link

ishunyu commented Mar 17, 2014

Hi great work on this project, I'm loving it.
However there is one little bug that probably hasn't seen very often.

I have a table view controller inside a tab bar view controller.
Currently, I make the call from the table view controller like this

- (IBAction)menuBarButtonPressed:(UIBarButtonItem *)sender
{
  // uncomment below to stop the table view from moving
  //  [self.tableView setContentOffset:self.tableView.contentOffset animated:NO];
  [HMTabBarViewController menuBarButtonPressedForViewController:self];
}

and then inside the tab bar view controller:

+ (void)menuBarButtonPressedForViewController:(UIViewController *)controller
{
  [(HMTabBarViewController *)[UIApplication sharedApplication].keyWindow.rootViewController menuBarButtonPressedForViewController:controller];
}

and

- (void)menuBarButtonPressedForViewController:(UIViewController *)controller
{
  RNGridMenu *gridMenu = [RNGridMenu visibleGridMenu];

  gridMenu = [[RNGridMenu alloc] initWithItems:self.gridMenuItems]; // Already have the menu items array
  [gridMenu setDelegate:self];

  [gridMenu showInViewController:controller center:CGPointMake(self.view.bounds.size.width/2.f, self.view.bounds.size.height/2.f)];
}

So this works great!

However, if I scroll the table view, and while the table view is moving, I try to open the grid menu, the grid menu will also move with the table view and it results in the grid menu either shifted up or down.

Next I tried to stop the table from moving before calling the grid menu, it works most of the time. However if the table view is in the process of refreshing(where you pull down the table and a spinner spins at the top). The grid menu will also be shifted.

grid menu bug

@ishunyu
Copy link
Author

ishunyu commented Mar 17, 2014

Currently working around it by doing this

- (IBAction)menuBarButtonPressed:(UIBarButtonItem *)sender
{
  if (self.tableView.contentOffset.y < 0) {
    return;
  }

  // Stop the table
  [self.tableView setContentOffset:self.tableView.contentOffset animated:NO];
  [HMTabBarViewController menuBarButtonPressedForViewController:self];
}

@rlaferla
Copy link

rlaferla commented Apr 6, 2014

I'm seeing this same problem. The workaround works but would like to see the root problem fixed.

@ishunyu
Copy link
Author

ishunyu commented Apr 7, 2014

Looks like the author hasn't touched this repo in a while.

Another way is if you call

[gridMenu showInViewController:controller center:CGPointMake(self.view.bounds.size.width/2.f, self.view.bounds.size.height/2.f)];

with the parent tabbarviewcontroller instead of the children viewcontroller(in this case the tableviewcontroller) the whole screen will be blurred out and I think that might solve the problem too. Don't have time to test right now.

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