ios - 找不到实例方法 '-presentViewController:animated'

标签 ios objective-c cocoa-touch uiviewcontroller

我对此还很陌生,所以请多多包涵。我的代码中还有 2 个错误需要修复。在这两种情况下都找不到我的实例方法:

-(IBAction)goFlipSide {
    NSLog(@"goFlipSide has been called:");
    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideViewController" bundle:nil];

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:controller animated:YES];

    [controller release];
}

- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
    [self dismissViewControllerAnimated:YES];

    //This method gets fired when the user clicks done on the modal FlipsideViewController.  This is different
    //than the viewWillAppear.
    self.navigationController.navigationBarHidden = TRUE;
    /*
    if (self.goViewSuccess == TRUE) {
        //if the goViewSuccess boolean is set to YES - then we can load the load the goViewController
        NSLog(@"goViewSuccess is YES");
        [self loadGoViewController];
    }
    */
}

两个未找到的实例方法是:presentViewController:dismissViewControllerAnimated:

最佳答案

self 是什么类?这些方法只能在 UIViewController 上找到。完整的选择器是:

  • presentViewController:animated:completion:
  • dismissViewControllerAnimated:completion:

尝试添加完成 block 参数。

关于ios - 找不到实例方法 '-presentViewController:animated',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16095977/

相关文章:

ios - 在 iOS 中使用 Google map 时如何使用自定义标注进行注释?

c++ - 如何将此 C++ 函数转换为 Objective-C?

iphone - 在 iPhone 应用程序中重新加载表格 View ?

ios - 标签栏消失

ios - 如何在 10 个按钮中快速创建 1 个带颜色的微光渐变

ios - 更改导航 Controller 项目颜色

ios - 数字和名称的复数化(swift stringsdict)

ios - 获取 LLDB 断点中的方法名称和选择器

objective-c - cocoa 缺少什么?

ios - 使用 Xcode 和 Cocoapods 进行代码签名