SWRevealViewController 和 3D Touch quickActions
SWRevealViewController and 3D Touch quickActions
我有一个在 swift 中实现侧边菜单的应用程序。
(http://www.appcoda.com/sidebar-menu-swift/)
我实现了 3D 触摸快捷方式,快速操作,几乎可以使用。
问题是我没有实例化 revealViewController() 直接到达我的视图,代码如下:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let navVC = storyboard.instantiateViewControllerWithIdentifier("newsViewController") as! UINavigationController
self.window?.rootViewController?.presentViewController(navVC, animated: true, completion: nil)
不知道how/where是实例化revealViewController()。
我有:
self.revealViewController() == nil
现在的情况是菜单不想打开。
感谢您的帮助:-)
为了获得您的显示 ViewControlled,您必须将其作为故事板中的 InitialViewController,不需要在 Appdelgate 中编写任何代码。
您可以在 git hub storyboard example 中找到最佳示例
要么
像下面的屏幕截图一样设置
您可以这样找到答案link:
How to push viewcontroller from appdelegate in storyboard
我写的代码如下它适用于我。
UIStoryboard *st = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SWRevealViewController *mainRevealController = [[SWRevealViewController alloc] init];
CaseCollectionViewController *descController = (CaseCollectionViewController*)[st instantiateViewControllerWithIdentifier: @"CaseCollection"];
descController.selectedLevel = @"pll";
descController.title = @"PLL";
//UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:descController];
UINavigationController *frontNavigationController = (UINavigationController*)[st instantiateViewControllerWithIdentifier: @"NavigationViewCtrl"];
[frontNavigationController setViewControllers:@[descController]];
SidebarTableViewController *rearViewController = (SidebarTableViewController*)[st instantiateViewControllerWithIdentifier: @"SideBarView"];
mainRevealController.rearViewController = rearViewController;
mainRevealController.frontViewController = frontNavigationController;
self.window.rootViewController = mainRevealController;
想和Swift一起做的人:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let frontNavigationController = storyboard.instantiateViewControllerWithIdentifier("planningViewController")
let rearNavifationController = storyboard.instantiateViewControllerWithIdentifier("menuViewController")
let mainRevealController : SWRevealViewController = SWRevealViewController(rearViewController: rearNavifationController, frontViewController: frontNavigationController)
self.window?.rootViewController? = mainRevealController
Objective-c 代码 linking.It 将打开带侧边菜单的主页,并将主页(前面 viewcontroller)推送到通知 viewcontroller.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *frontViewControllerNav = [storyboard instantiateViewControllerWithIdentifier:@"homeNav"];// navigation controller of home screen..
UINavigationController *rearViewControllerNav = [storyboard instantiateViewControllerWithIdentifier:@"sideMenuNav"];//navigation controller of menu screen..
SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:rearViewControllerNav frontViewController:frontViewControllerNav];
revealController.delegate = self;
UIViewController *notificationView=[storyboard instantiateViewControllerWithIdentifier:@"notificationVC"];
[frontViewControllerNav pushViewController:notificationView animated:NO];
revealController.bounceBackOnOverdraw=NO;
//revealController.stableDragOnOverdraw=YES;
self.window.rootViewController = revealController;
我有一个在 swift 中实现侧边菜单的应用程序。 (http://www.appcoda.com/sidebar-menu-swift/)
我实现了 3D 触摸快捷方式,快速操作,几乎可以使用。
问题是我没有实例化 revealViewController() 直接到达我的视图,代码如下:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let navVC = storyboard.instantiateViewControllerWithIdentifier("newsViewController") as! UINavigationController
self.window?.rootViewController?.presentViewController(navVC, animated: true, completion: nil)
不知道how/where是实例化revealViewController()。
我有:
self.revealViewController() == nil
现在的情况是菜单不想打开。
感谢您的帮助:-)
为了获得您的显示 ViewControlled,您必须将其作为故事板中的 InitialViewController,不需要在 Appdelgate 中编写任何代码。
您可以在 git hub storyboard example 中找到最佳示例
要么
像下面的屏幕截图一样设置
您可以这样找到答案link: How to push viewcontroller from appdelegate in storyboard
我写的代码如下它适用于我。
UIStoryboard *st = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SWRevealViewController *mainRevealController = [[SWRevealViewController alloc] init];
CaseCollectionViewController *descController = (CaseCollectionViewController*)[st instantiateViewControllerWithIdentifier: @"CaseCollection"];
descController.selectedLevel = @"pll";
descController.title = @"PLL";
//UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:descController];
UINavigationController *frontNavigationController = (UINavigationController*)[st instantiateViewControllerWithIdentifier: @"NavigationViewCtrl"];
[frontNavigationController setViewControllers:@[descController]];
SidebarTableViewController *rearViewController = (SidebarTableViewController*)[st instantiateViewControllerWithIdentifier: @"SideBarView"];
mainRevealController.rearViewController = rearViewController;
mainRevealController.frontViewController = frontNavigationController;
self.window.rootViewController = mainRevealController;
想和Swift一起做的人:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let frontNavigationController = storyboard.instantiateViewControllerWithIdentifier("planningViewController")
let rearNavifationController = storyboard.instantiateViewControllerWithIdentifier("menuViewController")
let mainRevealController : SWRevealViewController = SWRevealViewController(rearViewController: rearNavifationController, frontViewController: frontNavigationController)
self.window?.rootViewController? = mainRevealController
Objective-c 代码 linking.It 将打开带侧边菜单的主页,并将主页(前面 viewcontroller)推送到通知 viewcontroller.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *frontViewControllerNav = [storyboard instantiateViewControllerWithIdentifier:@"homeNav"];// navigation controller of home screen..
UINavigationController *rearViewControllerNav = [storyboard instantiateViewControllerWithIdentifier:@"sideMenuNav"];//navigation controller of menu screen..
SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:rearViewControllerNav frontViewController:frontViewControllerNav];
revealController.delegate = self;
UIViewController *notificationView=[storyboard instantiateViewControllerWithIdentifier:@"notificationVC"];
[frontViewControllerNav pushViewController:notificationView animated:NO];
revealController.bounceBackOnOverdraw=NO;
//revealController.stableDragOnOverdraw=YES;
self.window.rootViewController = revealController;