0

I am building and anthat uses webView's.By selecting some tabs i'm displaying also some views non- webView. I have a problem with navigationController

I'm setting my navigationController in my Ncontrolls class that have the next code:

- (void)push{
   UIViewController myVC = [[UIViewController alloc] init];
    myVC.view.frame = currentNC.view.frame;
    UIImageView *logo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"house.png"]];    
    UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:logo ];
    [myVC.navigationItem setLefttBarButtonItem:buttonItem];
    [currentNC pushViewController:myVC animated:NO];

Every time i want to use the back button and when i am changing pages in UIWebView i'm calling the next code and using push, and adding back button

UIViewController *VC1 = [[UIViewController alloc] init];
[[AppDelegate sharedInstance].currentNC pushViewController:VC1 animated:NO];

I have some view's where I want to add nother button near to the back button, not replace it but adding near. I'm looking for option to set in some views my button near to back button.

This code add's one button :

UIBarButtonItem *button1 = [[UIBarButtonItem alloc] initWithCustomView:trView];
    [VC1.navigationItem setLefttBarButtonItem:button1 ];
    [currentNC pushViewController:dummyVC animated:NO];

When i am going to the next view and the back button appears, my button1 disappears. How can I in this moment add it near to the back button?

vadim
  • 119
  • 3
  • 14

2 Answers2

1

I think, it is impossible to have two buttons on navigation controller top, in one side. But, you can put button on the right.

self.navigationItem.rightBarButtonItem = buttonItem;
Andrey
  • 2,659
  • 4
  • 29
  • 54
1

You can add it by this method:

firstly: you should build your own back button and the new button and define there actions, then create a big button named "LargeButton" without action and add the two buttons inside it:

[LargeButton addSubview:backbtn];
[LargeButton addSubview:myButton];

then set the right navigation bar button to be the large button:

self.navigationItem.leftBarButtonItem = LargeButton;

in this method you will get a two buttons in the right side of the navigation bar.

Omar Freewan
  • 2,678
  • 4
  • 25
  • 49