UITextField

独奏

技术分享|2014-7-24|最后更新: 2023-2-23|
type
status
date
slug
summary
tags
category
icon
password
这里介绍一下关于 UITextField 的几个常用的操作,包括定义搜索框样式等

左侧添加图片

设置垂直居中

UITextField 继承自 UIControl,此类中有一个属性contentVerticalAlignment 所以想让UITextField里面的text垂直居中可以这样写:

用UITextField自定义UISearchBar样式

定义样式为左侧带放大镜,背景白色,圆角
notion image

设置内边框