前端之家收集整理的这篇文章主要介绍了
Swift 开发: 文本输入框(UITextField)的用法,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Swift - 文本输入框(UITextField)的用法
原文地址:http://hangge.com/blog/cache/detail_530.html 作者:yuhang
@H_301_13@1,文本框的创建,有如下几个样式:
UITextBorderStyle.None:无边框
UITextBorderStyle.Line:直线边框
UITextBorderStyle.RoundedRect:圆角矩形边框
UITextBorderStyle.Bezel:边线+阴影
1
2
3
4
@H_404_47@
|
var
textField =
UITextField
(frame:
CGRectMake
(10,160,200,30))
textField.borderStyle =
UITextBorderStyle
.
RoundedRect
self
.view.addSubview(textField)
@H_404_47@
|
@H_301_13@2,文本框提示文字
1
@H_404_47@
textField.placeholder=
"请输入用户名"
@H_404_47@
|