//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边框颜色的更多相关文章

  1. iOS开发--UIButton 设置圆角 边框颜色 点击回调方法

    UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; signBtn.frame = CGRectMake(, , , ) ...

  2. UIButton 设置圆角 边框颜色 点击回调方法

    UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; signBtn.frame = CGRectMake(, , , ) ...

  3. 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 ...

  4. css盒子模型之边框宽度,边框颜色与边框样式

    /* width和height只是设置盒子内容区的大小,而不是盒子的整个大小, 盒子可见框的大小由内容区,内边距和边框共同决定. */ .box1 { /* 设置内容区的宽度为400px */ wid ...

  5. winform设置button的边框颜色,或取消边框颜色,不显示边框

    // winform设置边框颜色不像webform那么简单,可以通过设置FlatAppearance,也可以通过重绘实现. 一.设置按钮本身属性 buttonBubufx.FlatStyle = Fl ...

  6. UIButton设置圆角和边框及边框颜色

    1. 按钮边框颜色 //设置边框颜色 [btn.layer setMasksToBounds:YES]; [btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 ...

  7. 使用storyboard设置button边框属性(颜色,宽度,圆角)

    通常使用Category时.仅仅能加入方法,不可加入属性.可是在使用Storyboard时我们可能会使用到keyPath,这里设置的key都须要是所设置视图的属性值.而且类型有所限制. 比如:我如今有 ...

  8. zxing生成二维码设置边框颜色

    真是研究了很久很久,满满的泪啊 zxing生成二维码,默认是可以增加空白边框的,但是并没有可以设置边框颜色的属性. 其中增加空白边框的属性的一句话是: Map hints = new HashMap( ...

  9. 设置UI控件的Layer属性(边框可见,边框颜色,边框宽度,边框圆角)

    设置UI控件的Layer属性 #import "ViewController.h" @interface ViewController () @property (strong, ...

随机推荐

  1. Windows版Cacti全新安装与升级

    全新安装 Cacti运行依赖的软件很多,mysql.PHP.Apache.Spine.rrd等,一个一个的安装非常繁琐,而且还容易出错,全新安装的话可以采用论坛提供的windows安装包安装,非常简单 ...

  2. 多数据库下activiti的流程定义缓存问题

    我们使用activiti(5.14版本号)作为流程引擎,今天在产品中发现一个问题,某流程的审批记录中, 活动实例表中记录的活动名称(ACT_HI_ACTINST表的ACT_NAME)居然是该流程中不存 ...

  3. 基于Quqrtz.NET 做的任务调度管理工具

    基于Quqrtz.NET 做的任务调度管理工具 国庆前,需求让我看了一下任务调度的数据表设计.和之前一样,有100多个字段,p1 ~ p100, 我说这是干嘛啊!按这写,写死去了! 然后在网上搜了一下 ...

  4. delphi字符串函数大全

    转帖:delphi字符串函数大全 2009-11-17 16:43:55 分类: delphi字符串函数大全 ━━━━━━━━━━━━━━━━━━━━━首部 function StringToGUID ...

  5. DataGridView的使用和批量修改

    DataGridView的属性:AllowUserToAddRows:如果为true允许用户添加行,false不允许用户添加行ReadOnly:true表示只读.不能修改单元格中的值,false可以对 ...

  6. Tomcat源码学习一

    这段时间工作不太忙,所以抽时间学习了TOMCAT, TOMCAT实际就是负责保持TCP连接传递到部署的项目中.浏览器实质就是TCP发送器.将用户的请求封装成TCP发送请求.当然格式是双方协定的.使用的 ...

  7. C++中文件的操作

    #include <iostream> #include <fstream> using namespace std; int main() { char s[27],m[27 ...

  8. Memcached缓存入门篇

    Asp.Net中使用Couchbase——Memcached缓存入门篇 前言 本文的主要目的就是简单的进行使用Memcached.这是Memchahed的官网http://memcached.org/ ...

  9. 实现了一个简单的key-value存储系统

    实现了一个简单的key-value存储系统 源码下载: kvfs.rar 正文: 所谓的Key-Value就是每次存储一个数据时,是根据Key进行索引存储的.为了实现Key的快速查找功能,我使用了B- ...

  10. ckeditor:复制内容到ckeditor时,只保留文本,忽略其样式解决方法

    打开ckeditor 包下的config.js,在 CKEDITOR.editorConfig= function(config){...}添加一句配置: config.forcePasteAsPla ...