0

我正在使用Storyboard,這是一個TabBarApplication。我如何設計它是每個選項卡都有UINavigationController,然後對應的UIViewController。 現在,當我收到一個UILocalNotification我想要一個特定的視圖,我想要顯示這個。如何在我收到UIlocalnotification時直接顯示UIViewController?

我在didReceiveLocalNotofication

if (!_tabBarController) { 
    _tabBarController = (UITabBarController *)_window.rootViewController; 
} 

NSArray *notificationName = [notification.userInfo valueForKey:@"kDetails"]; 
NSString * identifer = [notificationName objectAtIndex:1]; 

NSArray * vcs = [_tabBarController viewControllers]; 
UINavigationController * listVC = [vcs lastObject]; 
NSArray * array = [listVC viewControllers]; 

ListViewController * contacts = [array lastObject]; 
DetailsViewController * details = [[DetailsViewController alloc]initWithNibName:@"DetailsViewController" bundle:nil]; 
contacts.navigationItem.title = @"Details"; 

details.dataSet = [NSMutableArray arrayWithArray:[PersistData sharedData].completeData]; 
for (int i=0; i<[details.dataSet count]; i++) { 
    DataType * wid = [details.dataSet objectAtIndex:i]; 
    if ([wid.identifier isEqualToString:identifer]) { 
      // This is the meeting 
     details.index = i; 
    } 
    [contacts.navigationController pushViewController:details animated:YES]; 
} 

notification.fireDate = nil; 

這樣做,但這種不顯示所需的視圖。

+0

嗨..你的問題解決? – Rajneesh071

+0

還沒有。這隻會讓我進入我想去的Tab,但我仍然需要進一步進入特定的控制器。 – Ashutosh

回答

0

您必須設置當前選定的tabBarController。

[_tabBarController setSelectedIndex:indexOfLastTabItem]; 
+0

我試圖去的視圖控制器是被推倒在上面的代碼將顯示的那個。 – Ashutosh

+0

但您必須編寫此行才能使用tabbarcontroller上的選定索引 – Rajneesh071

+0

並確保您擁有vcs中的某些內容。 – Rajneesh071

相關問題