我已经使用 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/