gpt4 book ai didi

ios - SWRevealViewController 版本 2.4.0 segue 不工作 ios

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:14:00 25 4
gpt4 key购买 nike

在以前版本的 SWRevealViewController 中,我创建了 SWRevealViewControllerSegue 类 的 segue,在 prepareforSegue 中,我使用了以下代码。

#pragma mark - Navigation
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender
{
if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] )
{
SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;
swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {
UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
[navController setViewControllers: @[dvc] animated: NO ];

[self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
};

}
}

In the new version of SWRevealViewController,there is no segue of SWRevealViewControllerSegue class.Instead there is a class called SWRevealViewControllerSetSegue .I created a segue of this class but the navigation is not happening.

上面的代码不能在新版本中使用,因为它已被弃用。我应该在prepareforSegue中使用什么?

我该怎么做才能执行导航?请帮忙。

最佳答案

试试下面的代码

 UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SWRevealViewController *revealVC = (SWRevealViewController *)[storyBoard instantiateViewControllerWithIdentifier:@"revealVCID"];
[self presentViewController:revealVC animated:YES completion:nil];

关于ios - SWRevealViewController 版本 2.4.0 segue 不工作 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32410046/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com