一个很实用的,跳转填写 , 回来赋值.
// // 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]; }