1.设置UITextView背景图片,在UITextView区域内.
UITextView *textView = [[UITextView alloc] initWithFrame: CGRectMake(100,100,200,100)];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:[textView bounds]];
imageView.image = [UIImage imageNamed:@"background"];
[textView addSubview:imageView];
[textView sendSubviewToBack:imageView];
2.设置居中
textView.textAlignment = NSTextAlignmentCenter
3.给UITextView绘制圆角,通过QuartzCore框架,操作CALayer可以给UITextView绘制圆角边框
textView.layer.cornerRadius = 5;//设置圆角弧度。
textView.layer.masksToBounds = YES;
4.设置textview的边框和边框颜色
textView.layer.borderWidth = 0.5;
textView.backgroundColor = [UIColor whiteColor];