开发者

i cannot set the title for my navigationBar

开发者 https://www.devze.com 2023-01-02 11:43 出处:网络
here\'s my problem. i couldn\'t set the name for my navigationBar.. below are some i have tried but to no avail.

here's my problem. i couldn't set the name for my navigationBar.. below are some i have tried but to no avail.

- (void)viewDid开发者_JAVA技巧Lload {
  [super viewDidLoad];
  self.title = @"Food"; 
}

- (void)viewDidLload {
  [super viewDidLoad];
  [self.setTitle:@"Food"]; 
}

- (void)viewDidLload {
  [super viewDidLoad];
  MyTableViewController *myTableViewController = [[MyTableViewController alloc] init];
  myTableViewController = @"Food"; 
}

any kind soul?


Assuming this code is exactly like it is in your project, you mispelled the method name. Try this:

- (void) viewDidLoad {
    self.title = @"Food";
}

Also, the last two examples are just plain wrong.


make sure you have the navigation bar as a referencing outlet in IB, name with navBar or what ever you like, then in the code just add the line: [[navBar topItem] setTitle:@"title with code"];

0

精彩评论

暂无评论...
验证码 换一张
取 消