Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reload Navigation bar

In UITableView I configure self.navigationItem.leftBarButtonItem with a button. Now I want to reload this button to update text on this button, but it's on Navigation bar. I can update UITableView by

 [self.tableView reloadData]

but How to update Navigation bar?

Update: I'm NOT init the title of button, but reload it. So any init code (such as self.navigationItem.leftBarButtonItem.title = @"balabala") doesn't work, because it does NOT take effect immediately.

like image 881
Yuwen Yan Avatar asked Feb 02 '13 11:02

Yuwen Yan


People also ask

How do I reset my navigation bar?

Click the Collapse Pane icon in the space between the Navigation Bar and the Main Window. The Navigation Bar is collapsed, and the Main Window is expanded horizontally across the entire screen. 2. To restore the Navigation Bar to its original width, click the Restore Pane icon on the left side of the window.

What is the navigation toolbar?

The Navigation Toolbar is the toolbar that shows in the screenshot below the Tab bar the the location (address) bar on it. Firefox uses a combined Stop/Reload/Go button that is positioned at the right end of the location bar. You get a Stop button during page loading that changes to a Reload button when the page has finished loading.

How do I add a navigation bar to the page?

A navigation bar is a navigation header that is placed at the top of the page: With Bootstrap, a navigation bar can extend or collapse, depending on the screen size. A standard navigation bar is created with <nav class="navbar navbar-default">. The following example shows how to add a navigation bar to the top of the page: ...

Can I move the urlbar on the navigation toolbar?

There is now one large urlbar container that contains the location bar and the Back and Forward buttons and the combined Stop/Reload/Go button that is located at the right end of the location bar. This urlbar container is locked to its position on the Navigation Toolbar and can't be moved.

Can the navigation bar be fixed at the top or bottom?

The navigation bar can also be fixed at the top or at the bottom of the page. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. The .navbar-fixed-top class makes the navigation bar fixed at the top:


Video Answer


2 Answers

Just change the text on the leftBarButtonItem?

self.navigationItem.leftBarButtonItem.title = @"Back"; // or whatever text you want
like image 69
Nandeep Mali Avatar answered Oct 20 '22 00:10

Nandeep Mali


Try this

UIBarButtonItem *btnBack = [[UIBarButtonItem alloc]
                               initWithTitle:@"Title" 
                               style:UIBarButtonItemStyleBordered
                               target:self
                               action:@selector(OnClick:)];
self.navigationItem.leftBarButtonItem = btnBack;

Hope this helps you..

EDIT :-

UIBarButtonItem *btnBack = [[UIBarButtonItem alloc] initWithTitle: @"Title" style: UIBarButtonItemStyleBordered target:self action:@selector(OnClick:)];

[[self navigationItem] setBackBarButtonItem: btnBack];
like image 41
P.J Avatar answered Oct 19 '22 23:10

P.J