Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.91 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Set a UIViewController's title with a NSMutableArray item
  2. NSArray *foodArr = [NSArray arrayWithObjects:@"Chicken",@"Cheese",@"Hamburger"]
  3.        
  4. NSString *foodTitle = [foodArr objectAtIndex:1];
  5.        
  6. self.navigationController.title = foodTitle;
  7.        
  8. yourViewController.title = [self.myNameArray objectAtIndex:selectedIndex];
  9.        
  10. yourViewController.title = [[self.myObjectArray objectAtIndex:selectedIndex] title];
  11.        
  12. -(void) viewDidLoad {
  13.  
  14.    self.navigationItem.title = [NSString stringWithString:@"%@",[yourTitles objectAtIndex:yourIndex];
  15.  
  16. }
  17.        
  18. -(void) viewDidLoad {
  19.  
  20.    [titleLabel setText:[NSString stringWithString:@"%@",[yourTitles objectAtIndex:yourIndex]];
  21.  
  22. }
  23.        
  24. //Assuming you are displaying food item in tableView
  25. //vController is class object which is going to be pushed on navigation stack
  26. //Put this line in didSelectRowAtIndexPath method
  27.  
  28. yourViewControllerObject.title = [foodItemArray objectAtIndex:indexPath.row];