zoukankan      html  css  js  c++  java
  • 一个很实用的,跳转填写 , 回来赋值.

    //
    //  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];
    }
  • 相关阅读:
    .NET 4.0 System.Threading.Tasks学习笔记
    c#初学-多线程中lock用法的经典实例
    Spring3 Schedule Task之注解实现 (两次起动Schedule Task 的解决方案)
    支持向量机中的函数距离的理解
    Sqlserver 2016 R Service环境安装的各种错误(坑)解决办法
    Sql server的Merge语句,源表中如果有重复数据会导致执行报错
    对IIS7经典模式和集成模式的理解(转载)
    VisualStudio编译项目时,提示bin目录和obj目录下的文件不能写的错误处理的解决办法
    SQL Server 全文索引介绍(转载)
    sql server全文索引使用中的小坑 (转载)
  • 原文地址:https://www.cnblogs.com/fume/p/5647935.html
Copyright © 2011-2022 走看看