如何解决'SideMenu'CocoaPod的'AppDelegate类型的值'没有成员'navigationController''问题?

问题描述

我正在使用'SideMenu'Cocoapod,并且按照我的说法复制并粘贴了代码以在AppDelegate.swift中添加视图控制器,除了addPanGesture和addScreenEdgePanGesture之外,一切都很好。这是我整个AppDelegate.swift的代码

import UIKit
import SideMenu
    
@main
class AppDelegate: UIResponder,UIApplicationDelegate {

    func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
        // Define the menus
        let leftMenuNavigationController = SideMenuNavigationController(rootViewController: UIViewController())
        SideMenuManager.default.leftMenuNavigationController = leftMenuNavigationController

        let rightMenuNavigationController = SideMenuNavigationController(rootViewController: UIViewController())
        SideMenuManager.default.rightMenuNavigationController = rightMenuNavigationController

        // Setup gestures: the left and/or right menus must be set up (above) for these to work.
        // Note that these continue to work on the Navigation Controller independent of the view controller it displays!
        SideMenuManager.default.addPanGesturetoPresent(toView:
            self.navigationController.navigationBar)
        SideMenuManager.default.addScreenEdgePanGesturesToPresent(toView: self.navigationController.view)


        // (Optional) Prevent status bar area from turning black when menu appears:
        leftMenuNavigationController.statusBarEndAlpha = 0
        // copy all settings to the other menu
        rightMenuNavigationController.settings = leftMenuNavigationController.settings
    }

    // MARK: UIScenesession Lifecycle

    // If you need your SideMenu to appear from the right side
    func application(_ application: UIApplication,configurationForConnecting connectingScenesession: UIScenesession,options: UIScene.Connectionoptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration",sessionRole: connectingScenesession.role)
    
        
    }

    func application(_ application: UIApplication,diddiscardScenesessions scenesessions: Set<UIScenesession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running,this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes,as they will not return.
    }
}

如果有人知道我需要添加些什么来使这些问题消失,请告诉我!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...