一个很实用的,跳转填写 , 回来赋值.
2016-07-06 19:42
387 查看
// // IntextViewController.h // resume // // Created by on 16/7/1. // Copyright © 2016年 All rights reserved. // #import "BaseViewController.h" @interface IntextViewController : BaseViewController @property(nonatomic,strong)NSString *editStr; @property(nonatomic,assign)id delegate; @property (weak, nonatomic) IBOutlet UITextView *editTextView; @property(nonatomic,assign)NSInteger count; @end
// // IntextViewController.m // resume // // Created by on 16/7/1. // Copyright © 2016年 . All rights reserved. // #import "IntextViewController.h" #import "InvitationViewController.h" @interface IntextViewController () @property (strong, nonatomic) UIButton *rightBarBtn; @end @implementation IntextViewController - (void)viewDidLoad { [super viewDidLoad]; [self addTopBackView]; [self addtitleWithName:@"公司信息填写"]; [self addRightBarButtomWithButton:self.rightBarBtn]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(leftButtonClicked) forControlEvents:UIControlEventTouchUpInside]; button.frame = CGRectMake(10, 20 + 7 , 30, 30); [self.view addSubview:button]; // [self addLeftBarButtonItem]; _editTextView.text =[NSString stringWithFormat:@"%@", _editStr]; [_editTextView becomeFirstResponder]; } - (UIButton *)rightBarBtn { if (_rightBarBtn == nil) { _rightBarBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_rightBarBtn setTitle:@"修改" forState:UIControlStateNormal]; [_rightBarBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [_rightBarBtn addTarget:self action:@selector(leftButtonClicked) forControlEvents:UIControlEventTouchUpInside]; _rightBarBtn.frame = CGRectMake(0, 0, 60, 40); } return _rightBarBtn; } -(void)leftButtonClicked { if (self.delegate && [self.delegate respondsToSelector:@selector(getTextView:with:)]) { [self.delegate getTextView:_editTextView.text with:_count]; } [self.navigationController popViewControllerAnimated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark -- 判断字符串是否是纯数字 -(BOOL)isPureInt:(NSString *)string{ NSScanner* scan = [NSScanner scannerWithString:string]; int val; return [scan scanInt:&val] && [scan isAtEnd]; } @end
在你的主页面里写上这个方法
//获取填写的text -(void)getTextView:(NSString *)text with:(NSInteger )index{ [_contentAry replaceObjectAtIndex:index withObject:text]; [_infoTable reloadData]; //最后为textview的修改 if (index == [_contentAry count]-1) { [_signTextView setText:text]; } }
最后用你获取的text取代cell的一部分
- (IBAction)touchedTextView:(id)sender { EditInfoViewController *editView = [[EditInfoViewController alloc] initWithNibName:@"EditInfoViewController" bundle:nil]; editView.hidesBottomBarWhenPushed = YES; editView.count = [_contentAry count]-1; editView.delegate = self; editView.editStr = [_contentAry objectAtIndex:[_contentAry count]-1]; editView.textLength = 140; editView.titleName = @"职位描述"; [self.navigationController pushViewController:editView animated:YES]; }
相关文章推荐
- java数据类型总结--基本+引用
- Holistically-Nested Edge Detection
- js正则验证
- hibernate基础部分总结
- C++控制台显示日期时间和坐标排列
- hibernate 一对多的单项关联-表的搭建
- Linux下同步工具inotify+rsync使用详解
- java中常用的类--string和stringbuffer
- 工作心态
- MYSQL 测试性能测试网站-----dimitrik.free.fr
- 【bzoj2761】[JLOI2011]不重复数字
- uva10129
- DividerDecoration 文件,recyclerview 分割线
- CDN加速
- BZOJ 2096 [Poi2010]Pilots
- HDOJ 5145 NPY and girls
- Android之VideoView播放视频
- Python虚拟环境(Virtualenv)
- 【spring】BeanFactoryPostProcessor使用场景之PropertyPlaceholderConfigurer
- 护眼色