I am working in UITabBarController based iPhone app. My app having 5 taps. In my 4th tap UIViewController having one Child UIViewController. My First RootViewController screen title is “All Messages”. My second UIViewController name is “Conversations”.
The screen flow is tap 4 -> All Messages -> Conversation
All Messages contains UITableView so if the user clicks any message from tableview we are taking the user to Conversation screen (UIViewController). This screen shows particular users messages.
From this child UIViewController I have to update Parent viewController’s title name form “All Messages” to “New Messages(1)” and also the back button name should change from “All Messages” to “New Messages(1)”
I have followed the below code to update the screen title. This code is in my Child view controller named Conversation screen.
AllMessagesViewController *mesViewController = [[AllMessagesViewController alloc] init];
mesViewController.navigationItem.title = @"New Messages(1)";
Anyone please help me where am doing wrong? This approach is correct? Please help me to do this. Thanks in advance.
Try to use
NSNotificationCenter.In
AllMessagesViewControllerdeclare a method:and then register the view controller for a notification event
Then when you want to change the title from
ConversationViewControllersend a notify:This method will call
changeTitle:method inAllMessagesViewControllerso you just change the title using the parameternewTitle: