//联系人:石虎QQ: 1224614774昵称:嗡嘛呢叭咪哄
/**
注意点:
1.看 GIF 效果图.
2.看连线视图的效果图.
3.看实现代码(直接赋值实现效果).
*/
一、GIF 效果图:
二、连线视图的效果图:
图1:
图2:
三、实现代码:
=======
================================
=======
控制器1:
// ViewController.m
// AttributeValues(属性传值)
//
// Created by石虎on 2017/7/24.
// Copyright © 2017年shihu. All rights reserved.
//
#import"ViewController.h"
#import"SHTwoViewController.h"
@interfaceViewController()
//输入的文本
@property(weak,nonatomic)IBOutletUITextField*attributesField;
//点击传值
- (IBAction)attributesBtn:(id)sender;
@end
@implementationViewController
- (void)viewDidLoad {
[superviewDidLoad];
}
- (IBAction)attributesBtn:(id)sender {
SHTwoViewController*twoVc = [[SHTwoViewControlleralloc]init];
twoVc.attributesString=self.attributesField.text;
[selfpresentViewController:twoVcanimated:YEScompletion:nil];
}
@end
=======
================================
=======
控制器2:
// SHTwoViewController.m
// AttributeValues(属性传值)
//
// Created by石虎on 2017/7/24.
// Copyright © 2017年shihu. All rights reserved.
//
#import"SHTwoViewController.h"
@interfaceSHTwoViewController()
@property(weak,nonatomic)IBOutletUITextField*shareInputField;
@end
@implementationSHTwoViewController
- (void)viewDidLoad {
[superviewDidLoad];
//得到数据并且显示在界面上
self.shareInputField.text=self.attributesString;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event {
[self.viewendEditing:YES];
[selfdismissViewControllerAnimated:YEScompletion:nil];
}
@end
谢谢!!!