码迷,mamicode.com
首页 > 移动开发 > 详细

iOS UITextField 设置下底边

时间:2016-06-12 20:09:57      阅读:505      评论:0      收藏:0      [点我收藏+]

标签:

@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 设置下底边

标签:

原文地址:http://www.cnblogs.com/poky/p/5578499.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!