简体   繁体   English

从Xib到故事板Objective-C的Segue

[英]Segue from xib to storyboard objective-C

Assume there are 2 UIViewControllers in the storyboard,say 'A' and 'B'. 假设情节提要中有2个UIViewController,例如“ A”和“ B”。 Also, there is a xib file,say 'C', with .h and .m files. 此外,还有一个xib文件,例如'C',以及.h和.m文件。 'A' accesses a method of C which adds its own view on A's view. “ A”访问C的方法,该方法在A的视图上添加自己的视图。 C also has a method which does [self.view removeFromSuperView]. C还具有执行[self.view removeFromSuperView]的方法。 What I wish to do is after the C's view is removed,I want to segue to B. 我想做的是在删除C的视图之后,我想与B对话。

Note: I'm not using a navigation view controller in my implementation. 注意:我没有在实现中使用导航视图控制器。

What I've tried so far('poi' below is B's storyboard ID): 到目前为止,我已经尝试过(下面的“ poi”是B的情节提要ID):

[self dismissViewControllerAnimated:YES completion:nil];
[self.view removeFromSuperview];
UIStoryboard * myStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
B *chartpage = [myStoryboard instantiateViewControllerWithIdentifier:@"poi"];
[self presentModalViewController:chartpage animated:YES];

WARNING: " Presenting view controllers on detached view controllers is discouraged " and also, the method 'presentModalViewController' is deprecated. 警告:“ 不建议在分离的视图控制器上显示视图控制器 ”,并且不建议使用 “ presentModalViewController”方法。

尝试调用window的rootViewController的presentViewController:animated:completion:方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM