我正在将MFSideMenu
导入到我的虚拟项目中。 我正在使用以下代码
.h file
#import <UIKit/UIKit.h>
#import "MFSideMenu.h"
#import "RightSideViewController.h"
#import "MFSideMenuContainerViewController.h"
@interface xyzAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property(strong,nonatomic)UINavigationController * navigationController;
@property(strong, nonatomic) RightSideViewController * rightViewController;
@property(strong, nonatomic) MFSideMenuContainerViewController * container;
和 .m 文件是
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window= [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
UIStoryboard * mainstoryboard = [UIStoryboard storyboardWithName:@"main" bundle:nil];
xyzViewController * vc = [mainstoryboard instantiateViewControllerWithIdentifier:@"xyzViewController"];
[self.navigationController pushViewController:vc animated:YES];
self.navigationController = [[UINavigationController alloc]initWithRootViewController:vc];
self.rightViewController = [[RightSideViewController alloc]init];
self.container = [MFSideMenuContainerViewController containerWithCenterViewController:self.navigationController leftMenuViewController:nil rightMenuViewController:_rightViewController];
self.window.rootViewController = _container;
[self.window makeKeyAndVisible];
return YES;
}
当我运行项目时出现问题,它在模拟器上仅显示黑屏。
请帮我解决这个问题
我自己解决谢谢@pkc456
我将以下代码添加到我的.m文件中,现在它可以正常工作
self.window= [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
UIStoryboard * mainstoryboard = [UIStoryboard storyboardWithName:@"main" bundle:nil];
xyzViewController * vc = [mainstoryboard instantiateViewControllerWithIdentifier:@"xyzViewController"];
[self.navigationController pushViewController:vc animated:YES];
self.navigationController = [[UINavigationController alloc]initWithRootViewController:vc];