【问题标题】:SWRevealViewController back to previous viewcontroller not workingSWRevealViewController 回到以前的视图控制器不起作用
【发布时间】:2016-05-23 15:50:15
【问题描述】:

我正在使用 SWRevealViewController,我正在尝试实现后退按钮

有我的代码可以转到另一个视图:

- (IBAction)goViewController:(id)sender {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *topViewController = [storyboard instantiateViewControllerWithIdentifier:@"globalFIndAutoCompleteID"];
[self.revealViewController pushFrontViewController:topViewController animated:YES];
}

和我的后退按钮代码:

  - (IBAction)backClick:(UIButton *)sender {
    [SVProgressHUD dismiss];

    [self.revealViewController.navigationController popViewControllerAnimated:YES];
}

【问题讨论】:

    标签: ios swrevealviewcontroller


    【解决方案1】:

    我解决了我用以下代码替换代码的问题:

    -(void) goViewController:(UIButton *)sender{
        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    appDelegate.previousController = self;
    
       UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
       UINavigationController *topViewController = [storyboard instantiateViewControllerWithIdentifier:@"globalFIndAutoCompleteID"];
      [self.revealViewController presentViewController:topViewController animated:YES completion:nil];
    }
    
    
    - (IBAction)backClick:(UIButton *)sender {
        [SVProgressHUD dismiss];
        [self dismissViewControllerAnimated:YES completion:^{}];
    }
    

    【讨论】:

      猜你喜欢
      • 2016-02-21
      • 2014-06-30
      • 2015-04-09
      • 1970-01-01
      • 1970-01-01
      • 2012-11-07
      • 2017-01-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多