//设置字体名字和字体大小
self.textView.font = [UIFont fontWithName:@"Arial"size:18.0];
//设置边框属性
self.textView.layer.cornerRadius = 10; //边框弧度
self.textView.borderColor = [UIColor darkGrayColor].CGColor; //设置边框颜色
self.textView.layer.borderWidth = 2; //边框宽度
设置是否可以滚动
//UITextView继承于UIScrollView
self.textView.scrollEnabled = NO;
//消除影响(iOS7 如果把UIscrollView 加在导航中一般内容会向下走64)
self.automaticallyAdjustsScrollViewInsets = NO;
//设置背景颜色
self.textView.backgroundColor = [UIColor whiteColor];
//UITextView下的键盘中return 表示换行
//返回键的类型
self.textView.returnKeyType = UIReturnKeyDefault;
//键盘类型
self.textView.keyboardType = UIKeyboardTypeDefault;
//自适应高度
self.textView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
[self.view addSubview: self.textView];//加入到整个页面中
}
二、协议