首页 > 解决方案 > Xcode 使用 Drawercontroller 未声明的类型错误

问题描述

我已经在我的项目中安装了 KYDrawercontroller。它在项目中可用并且可以导入它。任何帮助都将被应用。提前谢谢 在此处输入图像描述

标签: iosswift

解决方案


正如您可以在KYDrawerController 文档中查看您必须使用的那样,DrawerViewController并且KYDrawerController没有DrawerController

import UIKit
import KYDrawerController

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        let mainViewController   = MainViewController()
        let drawerViewController = DrawerViewController()
        let drawerController     = KYDrawerController()
        drawerController.mainViewController = UINavigationController(
            rootViewController: mainViewController
        )
        drawerController.drawerViewController = drawerViewController

        /* Customize
        drawerController.drawerDirection = .Right
        drawerController.drawerWidth     = 200
        */

        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window?.rootViewController = drawerController
        window?.makeKeyAndVisible()

        return true
    }

推荐阅读