0

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.

Renzo Mar
  • 21
  • 5

2 Answers2

1

just do the following in "viewDidLoad" (or place it there where you've got the title from your database):

self.title = @"McIntosh Commercial Bank";
Tobias Bambullis
  • 736
  • 5
  • 17
  • 45
  • Thank you for the answer, but if i do that, i see "McIntosh Commercial Bank" in the DetailView of all Banks. I like to show the Bank name (stored in the column "name" on the table "failed_banks" in database.sqlite) on the navigationBar. For example, see this image http://d1xzuxjlafny7l.cloudfront.net/wp-content/uploads/2010/04/FailedBanksTableView.jpg if i select "Desert Hills Bank" i go to the DetailView of that bank and i like to see "Desert Hills Bank" on the navigationBar, but if i select "Unity National Bank", i like to see "Unity National Bank" on the navigationBar in DetailView. – Renzo Mar May 31 '12 at 15:25
  • So, if i set self.title = @"McIntosh Commercial Bank"; i gonna see "McIntosh Commercial Bank" in Desert Hills Bank and Unity National Bank DetailView, and that is not what i need, i need to show the correct bank name for each bank. – Renzo Mar May 31 '12 at 15:30
  • just change the title at that point, you get your bank details from database... you don't have to change the title directly in viewDidLoad, you can change it everywhere else, too. – Tobias Bambullis May 31 '12 at 15:31
  • 1
    how do you fill the uilabels in you view? Do it like that! Example: bankname.text = [data objectForKey:@"bankname"]; self.title = [data objectForKey:@"bankname"]; – Tobias Bambullis May 31 '12 at 16:06
  • Where i exactly have to use that code? Thank you for your help. – Renzo Mar Jun 01 '12 at 20:20
  • I did this in FailedBankDetailViewController.m: -(void)viewDidLoad { nameLabel.text = [data objectForKey:@"bank"]; self.title = [data objectForKey:@"bank"]; but i have 2 errors: "nameLabel undeclared" and "data undeclared". what im doing wrong? – Renzo Mar Jun 01 '12 at 23:36
  • I don't know, because I haven't got your code. Maybe you should watch some tutorials on youtube to learn how to use interface builder. I think this isn't the right place to discuss every little something... – Tobias Bambullis Jun 02 '12 at 17:49
  • I post all of my code here http://stackoverflow.com/questions/10858474/ios-xcode-show-image-in-uiimage-view-from-path-saved-on-sqlite-database. My problem is not with Interface Builder. – Renzo Mar Jun 04 '12 at 18:55
0

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";
}
jonkroll
  • 15,682
  • 4
  • 50
  • 43