在你的主頁面里寫上這個方法 最後用你獲取的text取代cell的一部分 ...
// // 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]; }