-1

我尝试在 Objective-c中添加SlideMenuControllerSwift 。

我可以在我的 AppDelegate.m中访问[slideMenuController openLeft]

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ViewController *main = [sb instantiateViewControllerWithIdentifier:@"ViewController"];
    LeftViewController *left = [sb instantiateViewControllerWithIdentifier:@"LeftViewController"];

    UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:main];
    left.mainViewController = nvc;

    SlideMenuController *slideMenuController = [[SlideMenuController alloc] init];

    slideMenuController = [slideMenuController initWithMainViewController:nvc leftMenuViewController:left];

    [slideMenuController openLeft]; // appears with open menu

    self.window.rootViewController = slideMenuController;
    [self.window makeKeyAndVisible];

    return YES;
 }

SlideMenuControllerSwift具有UIViewController 扩展。

extension UIViewController {
 ....
    public func toggleLeft() {
        slideMenuController()?.toggleLeft()
    }

但是如何在 obj-c ViewController.m 中访问 toggleLeft() ?

4

1 回答 1

0

你可以参考这个链接。 https://github.com/romaonthego/RESideMenu

在此示例中,您可以获得实施侧菜单的流程。

于 2015-12-18T04:41:08.110 回答