iOS UITextField 设置下底边
生活随笔
收集整理的這篇文章主要介紹了
iOS UITextField 设置下底边
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(30, 100, 160, 30)];
textField.text = @"設置textField下邊框";
CALayer *bottomBorder = [CALayer layer];
bottomBorder.backgroundColor = [UIColor orangeColor].CGColor;
bottomBorder.frame = CGRectMake(0.0f, textField.frame.size.height - 1, textField.frame.size.width, 1.0f);
bottomBorder.backgroundColor = [UIColor blackColor].CGColor;
[textField.layer addSublayer:bottomBorder];
[self.view addSubview:textField];
[self.view setBackgroundColor:[UIColor lightGrayColor]];
}
@end
總結
以上是生活随笔為你收集整理的iOS UITextField 设置下底边的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 了解了解你自己的话zookeeper(从
- 下一篇: “三高”拉满HDR:这才是万元电视该有的