簡體   English   中英

從導航欄按鈕項目中隱藏或刪除特定項目,Swift 4

[英]Hide or remove specific item from navigation bar button items, Swift 4

從故事板提供的導航欄UIBarButtonItem隱藏或刪除特定按鈕項。

例如,右側導航欄項目我添加了 3 個UIBarButtonItem如故事板中的“完成”、“取消”、“下一步”,現在我想根據用戶登錄以編程方式從導航欄中刪除或隱藏“取消”按鈕,所以我可以為這個問題做些什么?

嘗試這個:

self.navigationItem.rightBarButtonItems?.remove(at: [indexOfButton])

[indexOfButton] 應該是 rightBarButtonItems 數組中按鈕的索引。

暫無
暫無

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

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