iOS:如何从一个 UIViewController 切换到另一个,包括在 SWRevealViewController

标签 ios objective-c uiviewcontroller viewcontroller swrevealviewcontroller

我有一个 SWRevealViewController 的例子来自 github。
现在我想了解,如何切换我的独立UIViewController到另一个,其中包括 SWRevealViewController .
我在某处读到这应该可行:

- (IBAction)action:(UIButton *)sender {
      SWRevealViewController *swcontroller = self.revealViewController;
      if (swcontroller) {
         self.revealViewController.frontViewController = [[UIViewController alloc] init];
      }
}

我从我的 UIButton 创建了一个模态序列至SWRevealViewController .
但它不起作用。
有人可以举个例子吗?

最佳答案

根据我的信息,您需要在 SWRevealViewController 中手动推送或弹出您的 View Controller 。如下所示,试试这个..

- (IBAction)btnActionSalesQuotation:(id)sender{
SWRevealViewController *revealview = self.revealViewController;

SalesQuotationsViewController *Gosalequo=[[SalesQuotationsViewController alloc]initWithNibName:@"SalesQuotationsViewController" bundle:nil];

[revealview pushFrontViewController:Gosalequo animated:YES];
}

关于iOS:如何从一个 UIViewController 切换到另一个,包括在 SWRevealViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32464534/

相关文章:

ios - 如何从 AFNetworking 中的 POST 请求中读取一个简单的字符串(无 JSON)

ios - 在 iOS 中出现 View 后,inputAccessoryView 随动画一起出现

ios - 将行动态添加到 UItableView,并为按钮保留最后两行

iphone - 如何判断 UIView 是否可见并显示在屏幕上?

ios - 在 iOS 5.1 中获取 CellID、MCC、MNC、LAC 和网络

objective-c - 构建 SourceKitten 时没有此类模块 SWXMLHash

iphone - 建议初始化数组(或其他对象)的最佳方法

iphone - 为什么加载 View Controller 时没有调用我的 initWithNib 方法?

ios - Container ViewController with 3 children must have a common parent view controller 错误

ios - 两个独立的 UIViewControllers 上的 UITabBarControllerDelegate - Swift