UITabbarController 配下の UINavigationController をモーダル表示する
3355 ワード
tabBarController デリゲートメソッドの shouldSelect viewController 内でNavigationController をインスタンス化してプレゼントします。
StoryBoard から TabBarItem に タグをつけることをお忘れなく。
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
guard viewController is UINavigationController else { return true }
if tabBarController.selectedIndex == 1 {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let popupViewController = storyboard.instantiateViewController(withIdentifier: "NavigationController") as! UINavigationController
popupViewController.modalPresentationStyle = .fullScreen
tabBarController.present(popupViewController, animated: true, completion: nil)
return false
} else {
return true
}
}
🐣
フリーランスエンジニアです。
お仕事のご相談こちらまで
[email protected]
Core MLを使ったアプリを作っています。
機械学習関連の情報を発信しています。
Author And Source
この問題について(UITabbarController 配下の UINavigationController をモーダル表示する), 我々は、より多くの情報をここで見つけました https://qiita.com/john-rocky/items/6684c535c0531adbaf0d著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .