swift设置textfield边框颜色
//swift3.0,如果是2.0的话也可以照着这个样子去写,语法有所变动。根据联想出来的就可以了。
let tx = UITextField(frame: CGRect(x: 100, y: 100, width: 100, height: 100))
tx.borderStyle = UITextBorderStyle.roundedRect
//所有类型
// typedef enum {
// UITextBorderStyleNone,
// UITextBorderStyleLine,
// UITextBorderStyleBezel,
// UITextBorderStyleRoundedRect
// } UITextBorderStyle;
tx.layer.borderWidth = 1; //边框的宽度
tx.layer.borderColor = UIColor.green.cgColor //边框的颜色,也可以自己定义颜色,可以使用 R,G,B了比如
// tx.layer.borderColor = UIColor(red: 225/225.0, green: 30/225.0, blue: 40/225.0, alpha: 1.0).cgColor
view.addSubview(tx)
2.0扩展,字体的设置(加粗倾斜等)
label.font=[UIFont fontWithName:@"ArialMT"size:24];
//fontWithName处字体不知道名字,可以看下面图片字体对照!
1.字体名如下(图片对照在最下面):
Font Family: American Typewriter
Font: AmericanTypewriter
Font: AmericanTypewriter-Bold
Font Family: AppleGothic
Font: AppleGothic
Font Family: Arial
Font: ArialMT
Font: Arial-BoldMT
Font: Arial-BoldItalicMT
Font: Arial-ItalicMT
Font Family: Arial Rounded MT Bold
Font: ArialRoundedMTBold
Font Family: Arial Unicode MS
Font: ArialUnicodeMS
Font Family: Courier
Font: Courier
Font: Courier-BoldOblique
Font: Courier-Oblique
Font: Courier-Bold
Font Family: Courier New
Font: CourierNewPS-BoldMT
Font: CourierNewPS-ItalicMT
Font: CourierNewPS-BoldItalicMT
Font: CourierNewPSMT
Font Family: DB LCD Temp
Font: DBLCDTempBlack
Font Family: Georgia
Font: Georgia-Bold
Font: Georgia
Font: Georgia-BoldItalic
Font: Georgia-Italic
Font Family: Helvetica
Font: Helvetica-Oblique
Font: Helvetica-BoldOblique
Font: Helvetica
Font: Helvetica-Bold
Font Family: Helvetica Neue
Font: HelveticaNeue
Font: HelveticaNeue-Bold
Font Family: Hiragino Kaku Gothic **** W3
Font: HiraKakuProN-W3
Font Family: Hiragino Kaku Gothic **** W6
Font: HiraKakuProN-W6
Font Family: Marker Felt
Font: MarkerFelt-Thin
Font Family: STHeiti J
Font: STHeitiJ-Medium
Font: STHeitiJ-Light
Font Family: STHeiti K
Font: STHeitiK-Medium
Font: STHeitiK-Light
Font Family: STHeiti SC
Font: STHeitiSC-Medium
Font: STHeitiSC-Light
Font Family: STHeiti TC
Font: STHeitiTC-Light
Font: STHeitiTC-Medium
Font Family: Times New Roman
Font: TimesNewRomanPSMT
Font: TimesNewRomanPS-BoldMT
Font: TimesNewRomanPS-BoldItalicMT
Font: TimesNewRomanPS-ItalicMT
Font Family: Trebuchet MS
Font: TrebuchetMS-Italic
Font: TrebuchetMS
Font: Trebuchet-BoldItalic
Font: TrebuchetMS-Bold
Font Family: Verdana
Font: Verdana-Bold
Font: Verdana-BoldItalic
Font: Verdana
Font: Verdana-Italic
Font Family: Zapfino
Font: Zapfino
这里写图片描述


修改textField的placeholder的字体颜色、大小
使用KVO实现
textField.placeholder = @”username is in here!”;
[textField setValue:[UIColor redColor] forKeyPath:@”_placeholderLabel.textColor”];
[textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@”_placeholderLabel.font”];
)
swift设置textfield边框颜色的更多相关文章
- iOS开发--UIButton 设置圆角 边框颜色 点击回调方法
UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; signBtn.frame = CGRectMake(, , , ) ...
- UIButton 设置圆角 边框颜色 点击回调方法
UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; signBtn.frame = CGRectMake(, , , ) ...
- JAVA swing中JPanel如何实现分组框的效果以及设置边框颜色 分类: Java Game 2014-08-16 12:21 198人阅读 评论(0) 收藏
代码如下: import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridLayout; import javax.sw ...
- css盒子模型之边框宽度,边框颜色与边框样式
/* width和height只是设置盒子内容区的大小,而不是盒子的整个大小, 盒子可见框的大小由内容区,内边距和边框共同决定. */ .box1 { /* 设置内容区的宽度为400px */ wid ...
- winform设置button的边框颜色,或取消边框颜色,不显示边框
// winform设置边框颜色不像webform那么简单,可以通过设置FlatAppearance,也可以通过重绘实现. 一.设置按钮本身属性 buttonBubufx.FlatStyle = Fl ...
- UIButton设置圆角和边框及边框颜色
1. 按钮边框颜色 //设置边框颜色 [btn.layer setMasksToBounds:YES]; [btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 ...
- 使用storyboard设置button边框属性(颜色,宽度,圆角)
通常使用Category时.仅仅能加入方法,不可加入属性.可是在使用Storyboard时我们可能会使用到keyPath,这里设置的key都须要是所设置视图的属性值.而且类型有所限制. 比如:我如今有 ...
- zxing生成二维码设置边框颜色
真是研究了很久很久,满满的泪啊 zxing生成二维码,默认是可以增加空白边框的,但是并没有可以设置边框颜色的属性. 其中增加空白边框的属性的一句话是: Map hints = new HashMap( ...
- 设置UI控件的Layer属性(边框可见,边框颜色,边框宽度,边框圆角)
设置UI控件的Layer属性 #import "ViewController.h" @interface ViewController () @property (strong, ...
随机推荐
- Python 2.7.3 urllib2.urlopen 获取网页出现乱码解决方案
出现乱码的原因是,网页服务端有bug,它硬性使用使用某种特定的编码方案,而并没有按照客户端的请求头的编码要求来发送编码. 解决方案:使用chardet来猜测网页编码. 1.去chardet官网下载ch ...
- 快速构建Windows 8风格应用31-构建磁贴
原文:快速构建Windows 8风格应用31-构建磁贴 引言 磁贴是吸引用户经常使用应用重要手段之一.我们可将应用程序内较好的内容使用磁贴进行展示. 另外应用程序磁贴是应用程序中的核心部分,而且很可能 ...
- appserv+win8
在win8系统安装appserv后,假设apache2服务不安装成功,在安装文件夹Apache2.2手动执行apache_servicefix.bat要么apache_serviceinstall.b ...
- HDU 2079-课程时间(生成函数)
课程时间(标题已被修改,注意阅读题) Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- Linux下使用cat制作“内涵图”
http://blog.csdn.net/odaynot/article/details/7939869
- 打开VMware的系统出错
打开VMware系统时,出现错误 “Invalid configuration file. File "I:/My Virtual Machines/Windows XP english P ...
- Android项目--Json解析
在过去的一段时间里,我希望做一个天气的应用,但是由于老版的天气接口已经不能用了.只能更新到2014年3月4日. 不过有些东西,哪来学习一下,也是可以的. 比如:http://m.weather.com ...
- android项目--上下文菜单
一般说到上下文菜单基本上都是长按事件,在一个控件上长按,就会弹出一个菜单. 1.创建上下文菜单: //覆盖方法,创建上下文菜单 @Override public void onCreateContex ...
- 【转】视差滚动(Parallax Scrolling)效果的原理和实现
原文:http://www.cnblogs.com/JoannaQ/archive/2013/02/08/2909111.html 视差滚动(Parallax Scrolling)是指让多层背景以不同 ...
- android shape总结 和控制的风格定制
1:shape总结 1):shape文件是放置在drawable文件下的.res/drawable/filename.xml. 2):shape类型:android:shape. 一共同拥有四种:re ...