
Untitled
By: a guest on
Aug 7th, 2012 | syntax:
None | size: 0.91 KB | hits: 13 | expires: Never
Set a UIViewController's title with a NSMutableArray item
NSArray *foodArr = [NSArray arrayWithObjects:@"Chicken",@"Cheese",@"Hamburger"]
NSString *foodTitle = [foodArr objectAtIndex:1];
self.navigationController.title = foodTitle;
yourViewController.title = [self.myNameArray objectAtIndex:selectedIndex];
yourViewController.title = [[self.myObjectArray objectAtIndex:selectedIndex] title];
-(void) viewDidLoad {
self.navigationItem.title = [NSString stringWithString:@"%@",[yourTitles objectAtIndex:yourIndex];
}
-(void) viewDidLoad {
[titleLabel setText:[NSString stringWithString:@"%@",[yourTitles objectAtIndex:yourIndex]];
}
//Assuming you are displaying food item in tableView
//vController is class object which is going to be pushed on navigation stack
//Put this line in didSelectRowAtIndexPath method
yourViewControllerObject.title = [foodItemArray objectAtIndex:indexPath.row];