1
votes

I'm using the SWRevealViewController library to use on my app as a left slide menu;

github link: SWRevealViewController

I've downloaded the following project example Appcoda project example and I've embedded the menu controller to a navigation controller so I can add items to the bar button , but I can't see the right bar button item that I've added (+ sign as example of ADD)

I've tried to change the menu controller width, but everything went wrong , do you know a way to short the side menu width so I can see the right bar button item added?

In the following image the + sigh stays under the left (main) controller.

I'm new to this kind of things :)

Thanks in advance

Example

2
It is actually under the MainViewController. Better not to use a navigation bar and right-bar button for this! Use a uibutton similar to add button and place it at the required position!Jen Jose
Hmm... I'll try that one and I'll say something laterIvan Cantarino

2 Answers

2
votes

Do something like the code below and set x value according to your position in cgrectmake

 UIButton *PlusBtn = [[UIButton alloc] initWithFrame:CGRectMake(0,0,44,44)];
    PlusBtn.tag = 654;
    [PlusBtn setImageEdgeInsets:UIEdgeInsetsMake(14, 14, 16, 16)];
    [PlusBtn setImage:[UIImage imageNamed:@"menu_icon1.png"] forState:UIControlStateNormal];
    [PlusBtn addTarget:self action:@selector(ShowLeft) forControlEvents:UIControlEventTouchUpInside];
    PlusBtn.enabled = NO;

    [self.navigationController.navigationBar addSubview:PlusBtn];
2
votes

In Storyboard you set the UiViewController's size to be freeform instead of Inferred under Attributes Inspector, then under Size Inspector you set the width of the ViewController according the the size that the button shows.enter image description hereenter image description here