我正在尝试在我的应用中实现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]];
}
答案 0 :(得分:1)
我认为我们需要更多细节。 KASideMenuContainerViewController
继承了什么?看起来它可能是从错误的View Controller继承而来的。我从未使用过MFSideMenu,但看起来KASideMenuContainerViewController
应该继承MFSideMenuContainerViewController
而不仅仅是MFSideMenu
答案 1 :(得分:0)
@erdemgc
我刚刚从github下载了该项目,它就像魅力一样。 尝试运行MFSideMenuDemoStoryboard项目。