UITextField border color

后端 未结 9 1472
一生所求
一生所求 2020-11-28 02:43

I have really great wish to set my own color to UITextField border. But so far I could find out how to change the border line style only.

I\'ve used background prope

9条回答
  •  一生所求
    2020-11-28 03:29

    Try this:

    UITextField *theTextFiels=[[UITextField alloc]initWithFrame:CGRectMake(40, 40, 150, 30)];
        theTextFiels.borderStyle=UITextBorderStyleNone;
        theTextFiels.layer.cornerRadius=8.0f;
        theTextFiels.layer.masksToBounds=YES;
            theTextFiels.backgroundColor=[UIColor redColor];
        theTextFiels.layer.borderColor=[[UIColor blackColor]CGColor];
        theTextFiels.layer.borderWidth= 1.0f;
    
        [self.view addSubview:theTextFiels];
        [theTextFiels release];
    

    and import QuartzCore:

    #import 
    

提交回复
热议问题