gpt4 book ai didi

ios - 如何为多个 View Controller 使用 SWRevealviewcontroller 库

转载 作者:行者123 更新时间:2023-11-28 07:36:02 24 4
gpt4 key购买 nike

我已经使用 SWrevealviewcontroller 来制作我的侧边菜单并且它工作成功,但是当我将它用于不同的 View Controller 来制作另一个侧边菜单时它会出现问题问题是

“View Controller“ is unreachable because it has no entry points and no identifier for runtime access via -[UIStoryboard instantiateViewControllerWithIdentifier:]

最佳答案

extension UIViewController {

func SetREvealviewcontroller(ControllerIdentifier:String,storyboardname:String) -> Void
{
let storyboard = UIStoryboard(name: storyboardname, bundle: nil)
let frontNavigationController:UINavigationController
let rearNavigationController:UINavigationController
let revealController = SWRevealViewController()
var mainRevealController = SWRevealViewController()



let sidebar = storyboard.instantiateViewController(withIdentifier: "MenuViewController")as! MenuViewController
let homepage = storyboard.instantiateViewController(withIdentifier: ControllerIdentifier)

frontNavigationController = UINavigationController(rootViewController: homepage)
rearNavigationController = UINavigationController(rootViewController: sidebar)
frontNavigationController.navigationBar.backgroundColor = UIColor.init(rgb:0x03253d)
frontNavigationController.navigationBar.barTintColor = UIColor.init(rgb:0x03253d)


revealController.frontViewController = frontNavigationController
revealController.rearViewController = rearNavigationController


frontNavigationController.navigationBar.isTranslucent = false




mainRevealController = revealController

appDelegate.window?.rootViewController = mainRevealController
}

关于ios - 如何为多个 View Controller 使用 SWRevealviewcontroller 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53152773/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com