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