一個很實用的,跳轉填寫 , 回來賦值.,很實用賦值

來源:互聯網
上載者:User

一個很實用的,跳轉填寫 , 回來賦值.,很實用賦值

////  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];}

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.