Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can <strong>set backGround image to navigationBar</strong> Using this </p> <p>Put in <code>didFinishLaunchingWithOptions</code></p> <pre><code>[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"title_bar.png"] forBarMetrics:UIBarMetricsDefault]; </code></pre> <p>Or you can <strong>set navigation bar image</strong> in any view using </p> <pre><code>UINavigationBar *navBar = [[self navigationController] navigationBar]; UIImage *image = [UIImage imageNamed:@"TopBar.png"]; [navBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; </code></pre> <p>Or you can <strong>set a view on your NavigationBar</strong> <a href="https://stackoverflow.com/questions/13890062/set-titleview-for-all-navigationcontroller-and-navigationitem/13890354#13890354">Link</a></p> <pre><code>[[UINavigationBar appearance] addSubview:yourView]; </code></pre> <p>or </p> <pre><code>self.navigationItem.titleView = YourView; </code></pre> <p>And <strong>set title</strong> using h</p> <pre><code>self.navigationItem.title = @"Your Title";  </code></pre> <p>And you can get navigationBarButton using this </p> <pre><code>-(void)getRightBarBtn { UIButton *Btn =[UIButton buttonWithType:UIButtonTypeCustom]; [Btn setFrame:CGRectMake(0.0f,0.0f,68.0f,30.0f)]; [Btn setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"yourImage.png"]] forState:UIControlStateNormal]; //[Btn setTitle:@"OK" forState:UIControlStateNormal]; //Btn.titleLabel.font = [UIFont fontWithName:@"Georgia" size:14]; [Btn addTarget:self action:@selector(yourBtnPress:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithCustomView:Btn]; [self.navigationItem setRightBarButtonItem:addButton]; } </code></pre> <p><strong>And set simple imageView on navigation Bar</strong></p> <pre><code>UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"star.png"]]; UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithCustomView:image]; self.navigationItem.rightBarButtonItem = backBarButton; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload