UITextView类似于textField的文本框,但这是属于一个视图类型的文本输入框
边框的使用也为.layer来显示边框
1、定义一个TextView(UITextView *名称;)
并初始化规定好大小
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 10, 400, 300)];
2、设置文字超过区域是否可以滑动:YES 可以, NO 不可以
(名称+.scrollEnabled = YES/NO;)
textView.scrollEnabled= YES;
3、设置文本视图的背景颜色(名称+.backgroundColor)
textView.backgroundColor = [UIColor blackColor];
4、设置字体颜色(名称+.textColor)
textView.textColor = [UIColor whiteColor];
5、设置字体大小(名称+.font)
textView.font = [UIFont systemFontOfSize:15];
6、设置文字(名称+.text)
textView.text= @"UITextView";
7、设置代理代理方法类似于TextField的方法用来监听
(名称+.delegate = self;)
textView.delegate= self;
8、显示
[self.view addSubview:textView];