matghazaryan / AMSlideMenu2

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.
MIT License
1.2k stars 194 forks source link

button for right slidemenu #16

Closed Phloxx1 closed 10 years ago

Phloxx1 commented 10 years ago

I have tried adding a custom button in code to the right slide out menu

(void)configureRightMenuButton:(UIButton *)button {

CGRect frame = button.frame;
frame = CGRectMake(0, 0, 20, 20);
button.frame = frame;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:@"menu_knob"] forState:UIControlStateNormal];

}

It worked perfectly. the only thing that bothers me is that it appears on every view.. what do I do to make it appear only in the first screen, when I open up the app?

and also if I add a Bar Button Item in the storyboard, it doesn't appear when I start the app. Is there any code I can erase to make the button that I added in storyboard to appear?

Thank you

arturdev commented 10 years ago

You can access to bar button item in content viewcontrollers via

UIBarButtonItem *rightButton = self.navigationController.navigationBar.topItem.rightBarButtonItem;

Now you can hide , or do what you want with this button, e.g.

rightButton.customView.hidden = YES;