MFSideMenu setLeftViewController无法识别的选择器发送到实例?

时间:2014-02-22 09:08:32

标签: ios objective-c uiviewcontroller

我正在尝试在我的应用中实现SideMenu功能,但我正在例外。

这是我的代码;

这段代码出了什么问题,我正在使用StoryBoard

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
 KASideMenuContainerViewController *container = (KASideMenuContainerViewController *)self.window.rootViewController;
 UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"navigationController"];
 UIViewController *leftSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"leftSideMenuViewController"];
 UIViewController *rightSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"rightSideMenuViewController"];

 [container setLeftMenuViewController:leftSideMenuViewController];
 [container setRightMenuViewController:rightSideMenuViewController];
 [container setCenterViewController:navigationController];

 return YES;
}

-(void)changeController:(UIViewController *)aViewController{
 KASideMenuContainerViewController *containerViewControllar = (KASideMenuContainerViewController *)self.window.rootViewController;

 [containerViewControllar.centerViewController setViewControllers:[NSArray arrayWithObject:aViewController]];
 }

2 个答案:

答案 0 :(得分:1)

我认为我们需要更多细节。 KASideMenuContainerViewController继承了什么?看起来它可能是从错误的View Controller继承而来的。我从未使用过MFSideMenu,但看起来KASideMenuContainerViewController应该继承MFSideMenuContainerViewController而不仅仅是MFSideMenu

答案 1 :(得分:0)

@erdemgc

我刚刚从github下载了该项目,它就像魅力一样。 尝试运行MFSideMenuDemoStoryboard项目。