//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. ActiveReports 9实战教程(2): 准备数据源(设计时、运行时)

    原文:ActiveReports 9实战教程(2): 准备数据源(设计时.运行时) 在上讲中<ActiveReports 9实战教程(1): 手把手搭建环境Visual Studio 2013 ...

  2. Spring IOC之容器扩展点

    一般来说,一个应用开发者不需要继承ApplicationContext实现类.取而代之的是,Spring IoC容器可以通过插入特殊的整合接口的实现来进行扩展.下面的几点将要讲述这些整合的接口. 1. ...

  3. 1cocos2dx扩展UI控制,CCControlSlider,CCScale9Sprite(九妹图。),CCControlSwitch,CCControlButton

     UI控件来自cocos2dx的扩展库.完好了UI方面的元素,使cocos2dx更加丰富多彩.使用扩展库需包括: #include "cocos-ext.h" USING_NS ...

  4. [译]Java 设计模式之装饰器

    (文章翻译自Java Design Pattern: Decorator – Decorate your girlfriend) 1.装饰模式的来历 让我们假设你在寻找一个女朋友.有来自像没美国中国日 ...

  5. 1951: [Sdoi2010]古文字猪

    1951: [Sdoi2010]古代猪文 链接:Click Here~ 题目: 一道非常好的组合数学题.!!.题目非常长.只是就以下几段话实用. iPig认为仅仅要符合文献,每一种能整除N的k都是有可 ...

  6. leetcode[87] Partition List

    题目:给定一个链表和一个数x,将链表中比x小的放在前面,其他的放在后头.例如: Given 1->4->3->2->5->2 and x = 3,return 1-> ...

  7. linux_shell 特殊符号的介绍

    linux_shell 特殊符号的介绍 2011-12-17 17:54:07 分类: 原文地址:linux_shell 特殊符号的介绍 作者:xu_liuzhen linux_shell 特殊符号的 ...

  8. String.Join的实现

    String.Join的实现 在开发中,有时候会遇到需要把一个List对象中的某个字段用一个分隔符拼成一个字符串的情况.比如在SQL语句的in条件中,我们通常需要把List<int>这样的 ...

  9. js模版引擎handlebars.js实用教程

    js模版引擎handlebars.js实用教程 阅读本文需要了解基本的Handlebars.js概念,本文并不是Handlebars.js基础教程,而是注重于实际应用,为读者阐述使用过程中可能会遇到的 ...

  10. HDU1423:Greatest Common Increasing Subsequence(LICS)

    Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the lengt ...