簡體   English   中英

UITabBarController選擇的選項卡錯誤(?)

[英]UITabBarController selected tab bug (?)

我的應用程序有一個帶有4個選項卡的UITabBarController,從父級顯示為模式視圖控制器。 應用程序完全支持橫向方向,因此可以隨時進行布局。

有一個非常奇怪的錯誤,上個月我只見過5次。 在執行某些操作(用戶不能說出確切順序,但顯然涉及方向更改)后,選定的選項卡項目將保持“橫向”狀態,而其他選項卡則處於正確的位置。 我無法提供更多信息,因為它是一個非常嚴重的錯誤。

編輯:它也發生在另一個人編寫的另一個應用程序中,因此這實際上可能是一個iOS錯誤。

屏幕截圖: 在此處輸入圖片說明

您可以嘗試在UITabBarController每個UIViewController上實現- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation ,然后在旋轉后設置- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation @property(nonatomic) NSUInteger selectedIndex屬性。

我以前沒有嘗試過,但是可以正常工作……

 - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
      [[self tabBarController] setSelectedIndex:[[self tabBarController] selectedIndex]];
 }

暫無
暫無

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

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