简体   繁体   English

如何在按钮单击iOS上显示随机视图控制器

[英]How to show random view controller on button click iOS

I have an app having 7 screen and 3 tabs. 我有一个具有7个屏幕和3个标签的应用程序。 on the screen 7 i have a button that submits data but after submitting data , the UI still shows screen 7 I want to show my screen 1 (of tab 1)so that user can restart next operation, screen 1 has nav bar , table view control and few other buttons. 在屏幕7上,我有一个提交数据的按钮,但是在提交数据后,UI仍显示屏幕7。我想显示我的屏幕1(选项卡1的屏幕),以便用户可以重新开始下一个操作,屏幕1具有导航栏,表格视图控制和其他几个按钮。

I know in submit action of the button i have to do some calling , but no idea exactly what to do.. 我知道在按钮的提交动作中我必须进行一些调用,但不知道该怎么做。

Pls suggest/help. 请提出建议/帮助。 Thanks in adv. 感谢在广告中。

Try: 尝试:

 NSArray *mycontrollers = self.tabBarController.viewControllers;
 NSLog(@"%@",mycontrollers);
 UINavigationController *nvc = [mycontrollers objectAtIndex:0];
 UIViewController *vc = [nvc topViewController];
 [self.navigationController popToViewController:vc animated:YES];

Control-drag form your button to you new viewcontroller and select Modal. 按住Control键将按钮拖到新的ViewController中,然后选择Modal。

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

相关问题 如何通过单击按钮移动到iOS中的另一个视图控制器? - How to move to another view controller in iOS on a Button Click? 在Button Click上移动到iOS中的另一个视图控制器 - Moving to another view controller in iOS on Button Click 单击下一个视图控制器的按钮时,如何显示加载标签? - How can I get my loading label to show up when I click button to next view controller? 如何在按钮单击时显示和隐藏视图 - How to show and hide a view on button click 当我在iOS中点击google上的标记时,如何使用两个按钮显示叠加信息视图 - How to show overlay info view with two button more when i click a marker on google in iOS 当我单击IOS中的按钮时,为什么视图不显示? - Why the view doesn't show when I click the button in IOS? 如何在单击按钮时向页面视图控制器添加详细视图 - How to add a detailed view to a page view controller on button click 如何在iOS的View Controller中显示多个View Controller - How to show multiple View Controllers inside a View Controller in iOS 单击按钮删除视图控制器 - removing a view controller on click of a button 如何使用Objective C在iOS中单击通知时打开视图控制器? - How to open a view controller on click a notification in iOS using Objective c?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM