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

Action buttons move up when the add/plus button is clicked #8

Open
xarlotie opened this issue Jul 23, 2015 · 8 comments
Open

Action buttons move up when the add/plus button is clicked #8

xarlotie opened this issue Jul 23, 2015 · 8 comments

Comments

@xarlotie
Copy link

I use the action buttons on a scrollview but when i click the plus button, all sub-buttons appear but they are translated upward. What might be causing this? Thanks!

@giridharvc7
Copy link
Owner

Can you post a screenshot ?

@xarlotie
Copy link
Author

ios simulator screen shot jul 23 2015 2 59 40 pm
ios simulator screen shot jul 23 2015 2 59 44 pm

@xarlotie
Copy link
Author

Even when i dont add the "Related Content" button and Ad view at the bottom, the flaoting action buttons still move.

ios simulator screen shot jul 23 2015 3 07 58 pm
ios simulator screen shot jul 23 2015 3 08 01 pm

@giridharvc7
Copy link
Owner

Ok, let me check, are you using swift ? Cos i havent tested it out in swift

@xarlotie
Copy link
Author

I'm using Objective-C. And the value for withScrollView is a webview's scrollview.

withScrollview:self.webView.scrollView

@xarlotie
Copy link
Author

Hi @gizmoboy7! Any update on this? Thanks!

@telmopmota
Copy link

Got the same issue after changed UINavigationBar backgroundImage.
Add below code and issue happens:

UINavigationBar *navBar = [[self navigationController] navigationBar];
UIImage *backgroundImage = [UIImage imageNamed:@"MyNavigationBarBackground"];
[navBar setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];

@haroldogtf
Copy link

I could fix this issue in my project using:

In My ViewController.m I remove the NavigationBar and StatusBar height size.

CGRect frame = CGRectMake(size.width - FAB_SIZE - MARGIN,
                          size.height - FAB_SIZE - MARGIN - navBarHeight - statusBarHeight,
                          FAB_SIZE,
                          FAB_SIZE);

I defined a new method in the VCFloatingActionButton.h

-(id)initWithFrame:(CGRect)frame 
       normalImage:(UIImage*)passiveImage 
   andPressedImage:(UIImage*)activeImage
    withScrollview:(UIScrollView*)scrView 
  andNavigationBar:(UINavigationBar*)navBar;

and Here the implementation of the new Method in VCFloatingActionButton.m

-(id)initWithFrame:(CGRect)frame 
       normalImage:(UIImage*)passiveImage 
   andPressedImage:(UIImage*)activeImage
    withScrollview:(UIScrollView*)scrView 
  andNavigationBar:(UINavigationBar*)navBar {

  self = [self initWithFrame:frame normalImage: passiveImage andPressedImage:activeImage withScrollview:scrView];

  if(navBar) {
      int statusBar = [UIApplication sharedApplication].statusBarFrame.size.height;

      _buttonView.frame = CGRectMake(frame.origin.x,
                                     frame.origin.y + navBar.frame.size.height + statusBar,
                                     frame.size.width,
                                     frame.size.height);

      _menuTable.frame = CGRectMake(SCREEN_WIDTH/4,
                                    0,
                                    0.75*SCREEN_WIDTH,
                                    SCREEN_HEIGHT - (SCREEN_HEIGHT - CGRectGetMaxY(self.frame) - navBar.frame.size.height - statusBar));
    }
    return self;
}

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

4 participants