从子界面获取数据返回给主界面
来源:互联网 发布:淘宝客推广有什么要求 编辑:程序博客网 时间:2024/06/05 08:33
子界面
@protocol getLabelDelegate <NSObject>- (void)getNString:(NSString *)str;@end@interface AddViewController : UIViewController@property (weak, nonatomic) id <getLabelDelegate> delegate;@end
- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view from its nib. UIBarButtonItem *rightBtnItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(finish)]; self.navigationItem.rightBarButtonItem = rightBtnItem;}-(void) finish{ [self.delegate getNString:@"abc"]; [self.navigationController popViewControllerAnimated:YES];}
主界面
@interface MyViewController : UIViewController<getLabelDelegate>@property (weak, nonatomic) id<getLabelDelegate> delegate;@end
@implementation MyViewController{// NSMutableArray *myArray; NSMutableArray *testArr;}- (void)getNString:(NSString *)str{ [testArr addObject:[[NSString alloc] initWithString:str]];}
- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view from its nib. UIBarButtonItem *rightBtnItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)]; self.navigationItem.rightBarButtonItem = rightBtnItem;}-(void)add{ AddViewController *addvc = [[AddViewController alloc] init]; addvc.delegate = self; [self.navigationController pushViewController:addvc animated:YES];}
0 0
- 从子界面获取数据返回给主界面
- QT 从子窗口返回主界面时处理
- jQuery登录界面,不用跳转页面即可提交post,可以从服务器端获取返回数据
- 微信小程序,返回数据给上一界面
- startActivityForResult方法不可跳过某个界面获取返回数据
- 获取 web界面数据
- jquery ajax 从后台获取数据到界面
- jquery ajax 从后台获取数据到界面
- Qt主界面获取对话框数据
- activity返回主界面
- 如何返回上一个界面并传值给上一个界面
- 给界面添加右滑返回
- 获取app的主窗口,返回主视图界面
- iOS如何从一个界面返回到指定界面?
- 界面返回
- android 如何从应用返回待机界面
- Intent从上个界面返回值
- 子界面进入主界面更新主界面数据源
- ansys workbench生成线体时出现问…
- ANSYS动力分析—谐响应分析(转载)…
- 香港的教育(2)——学前教育
- 移动硬盘里面的文件怎么恢复
- 手机更新失败丢失文件怎么恢复
- 从子界面获取数据返回给主界面
- 老字号,没那么容易倒——wifi共享精灵
- U盘文件被损坏如何才能恢复
- 用mysql数据库写的分词算法代码
- bool 和BOOL的区别
- 读取笔记本的摄像头的原始yuv数据,通过libav(ffmpeg编码)
- Git 过滤文件,控制上传
- 不常用到的sql语句记录
- yii上传图片、yii上传文件、yii控件activeFileField使用