简体   繁体   中英

How to show a title on navigationBar from database

Really thank you all for the answers in my first question.

Now i like to do something easy i think, but im trying to do it for some days and i finally i cant.

I continued using the same project of my first question www.raywenderlich.com/913/sqlite-101-for-iphone-developers-making-our-app

See this image please.

http://d1xzuxjlafny7l.cloudfront.net/wp-content/uploads/2010/04/FailedBanksTableView.jpg

Here we see "Failed Banks" on the navigationBar in the ListView. I know how to change that title, but i like to show the name of the bank on the navigationBar in DetailView.

See this image. For example, i like to show "McIntosh Commercial Bank" on the navigationBar.

http://d1xzuxjlafny7l.cloudfront.net/wp-content/uploads/2010/04/DetailView.jpg

I think this is not complicated, but i cant solve it yet.

Maybe can you explain me how to do it or show me how the code have to be.

Thank you for your time.

只需在“ viewDidLoad”中执行以下操作(或将其放在您从数据库中获得标题的位置):

self.title = @"McIntosh Commercial Bank";

Since your DetailView controller is being managed by a UINavigationController, you need to set the title property of your DetailView's UINavigationItem in order for it to show in the top navbar, like this:

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.navigationItem.title = @"McIntosh Commercial Bank";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM