簡體   English   中英

使用推播通知啟動應用程式時,UINavigationBar被隱藏

[英]UINavigationBar is hidden when app launch with push notification

我有一個ViewController 通常我用

MyBookingDetailedViewController * vcNavigate = [self.storyboard instantiateViewControllerWithIdentifier:@"MyBookingDetailedViewController"];
vcNavigate.bookId = [booking.bookingId intValue];
vcNavigate.status = booking.bookingStatus;

現在,我試圖在用戶單擊pushNotification時使用它打開它。 我所做的是在AppDelegate文件的didRecieveRemoteNotification中添加了以下內容。

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;

MyBookingDetailedViewController *booking = (MyBookingDetailedViewController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"MyBookingDetailedViewController"];
booking.bookId = [notificationId intValue];
booking.status = notificationStatus;

[navigationController pushViewController:booking animated:YES];

但是當它出現時,頂部導航欄被隱藏。 我不能回去,它只是視圖。

您可以將以下代碼放入MyBookingDetailedViewController中

- (void) viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}

請使用以下代碼並在視圖中應用此代碼,可能會為您提供幫助。

[self.navigationController.navigationBar setTranslucent:NO];
self.extendedLayoutIncludesOpaqueBars=NO;

我找到了正確的答案,如何處理“推送通知”加載頁面。 它正在使用NSNotificationCenter

應用程序didreceiveRemoteNotification並跳轉到特定視圖

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM