如何在xcode 6中设置UItextfield边框颜色

时间:2015-01-27 21:48:15

标签: xcode6

我一直在尝试(几周)在xcode 6中设置uitextfield / view边框颜色,但仍然无效。我已经尝试过在stackoverflow和其他论坛上找到的任何解决方案,但仍然无法正常工作。我使用Objective-C任何帮助?感谢

2 个答案:

答案 0 :(得分:0)

首先,您需要在实现文件中导入Core Graphics File:

#import <QuartzCore/QuartzCore.h>

然后使用此代码更改边框颜色:

 txtPass.layer.borderColor=[[UIColor redColor]CGColor];
 txtPass.layer.borderWidth= 1.0f;

如果您想提供边框,请使用

 txtPass.layer.cornerRadius=8.0f;
 txtPass.layer.masksToBounds=YES;

答案 1 :(得分:0)

以下是我的成就!非常感谢你们 I made it