来自NSObject类的ModalViewController

时间:2014-08-04 09:50:03

标签: ios xcode uinavigationcontroller viewcontroller presentviewcontroller

我在问,因为这里找不到答案。我有单例类从互联网上获取一些数据。在我获取数据之后,我需要将它传输到位于主视图控制器和导航控制器之后的第二位的视图控制器。

SingletonClass      |      | NavController-> MainViewController-> GettingDataViewcontroller(在我的例子中是ImagePickerViewController)

我尝试过所有我知道的事情:

  1. 此代码将显示所需的控制器和空白屏幕:
  2. ImagePickerViewController *imgPicker = [[ImagePickerViewController alloc] init]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:imgPicker]; UIViewController *vc = [[[[UIApplication sharedApplication] windows] firstObject] rootViewController]; [imgPicker getParsedUrls:self.picturesUrl]; [vc presentViewController:nav animated:YES completion:nil];

    1. 此代码将显示带有白色屏幕但没有对象(按钮等)的视图控制器:
    2. UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; ImagePickerViewController *imgPicker = [storyboard instantiateViewControllerWithIdentifier:@"ImagePicker"]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:imgPicker]; UIViewController *vc = [[[[UIApplication sharedApplication] windows] firstObject] rootViewController]; [imgPicker getParsedUrls:self.picturesUrl]; [vc presentViewController:nav animated:YES completion:nil];

      在两种方式中,我都会获得第二个控制器中的标志代码。我正在接受它。

      我想念的是什么?谢谢你的帮助

0 个答案:

没有答案