如何将string值从secondView发送到使用popover segue的mainView?
我想从secondView
发送string值到mainView
但我单击确定button使用此代码[self dismissViewControllerAnimated:YES completion:nil];
然后准备继续工作。 当我想点击确定button,我发送textfield
mainView
值到mainView
控制器。
谢谢你的回复。
在您的主视图控制器(包含标签)头文件中声明标签的出口:
@property (nonatomic, weak) IBOutlet UILabel *nameLabel;
在你的SettingsViewController.m
导入你的ViewController.h
。 并改变下面的OK
buttonl.ke>
- (IBAction)goBack:(id)sender { ViewController *vCtrl = (ViewController *)self.presentingViewController; vCtrl.nameLabel.text = yourTextField.text; [self dismissViewControllerAnimated:YES completion:nil]; }
编辑:
由于OP正在使用UINavigationController
并且推导了导航,所以方法应该改为:
- (IBAction)goBack:(id)sender { ViewController *vCtrl = (ViewController *)[[(UINavigationController *)self.presentingViewController viewControllers] lastObject]; vCtrl.nameLabel.text = yourTextField.text; [self dismissViewControllerAnimated:YES completion:nil]; }
- 应用程序崩溃时,不使用URL Scheme打开并打开
- 在iOS开发中,如果使用Core Graphics和/或Quartz 2D,我怎样才能绘制出一个渐变的圆形,使其看起来像一个球体?
- Iphone在长按造成一些矩形放大镜popup
- 如何从json字典自动创build模型类(NSObject)?
- pickerview上的随机崩溃didSelect:__ cffrloloop_is_calling_out_to_a_source1_perform1_function
- iPhone X上的WKWebView页面高度问题
- Google路线API无法在iOS中返回结果
- Swift 4.2:可枚举的枚举
- 在.framework中包含一个.framework是否可能?