Socket

OSI七层网络模型:
1.应用层.2.表示层.3.会话层.4.传输层.5.网络层.6.数据链路层.7.物理层

pragma mark ---输入框

-(void)footerTextView{
UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(10, SCR_H - 160, 60, 40)];
[btn setBackgroundColor:[UIColor yellowColor]];
[btn setTitle:@"常用语" forState:UIControlStateNormal];
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[self addSubview:btn];
self.texView = [[UITextView alloc]initWithFrame:CGRectMake(btn.frame.origin.x + 60 + 10, SCR_H - 160, SCR_W / 2 + 30, 40)];
self.texView.delegate = self;
[self addSubview:self.texView];

}

  • (void)textViewDidEndEditing:(UITextView *)textView{
    NSLog(@"结束编辑");
    NSDictionary *dic = @{@"leftStr":self.texView.text};
    Model *model = [[Model alloc]init];
    [model setValuesForKeysWithDictionary:dic];
    [self.dataArray addObject:model];
    [self.tableView reloadData];
    }

  • (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
    {
    if ([text isEqualToString:@"\n"])
    {

      // 将model对象加入到数组红
      if (self.texView.text.length > 1) {
          NSDictionary *dic = @{@"leftStr":self.texView.text};
          Model *model = [[Model alloc]init];
          [model setValuesForKeysWithDictionary:dic];
          [self.dataArray addObject:model];
          [self.tableView reloadData];
          self.texView.text = @"";
      }
      
      
      // 对内容清零
      [self.texView resignFirstResponder];
      return NO;
    

    }

    return YES;
    }

// 文本视图已经开始编辑

  • (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    NSLog(@"-----------");

    return YES;
    }

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容