oracle左填充_如何向uisearchbar添加左填充

oracle左填充

让我们从UITextField开始 (Let’s Start With UITextField)

Image for post
iOS 10 UISearchBar
iOS 10 UISearchBar

We know that Apple has not made it easy for us to access the UITextField reference on different OS versions. So here is the code to help you guys for safe access of UITextField across all iOS versions.

我们知道Apple并不能使我们轻松访问不同OS版本上的UITextField参考。 因此,以下代码可帮助您在所有iOS版本中安全访问UITextField

Image for post
Code snippet for accessing text field and changing its properties
用于访问文本字段并更改其属性的代码段

UISearchBar中的左填充 (Left Padding in UISearchBar)

Image for post
Code snippet for adding padding and changing left icon
用于添加填充和更改左侧图标的代码段

Now with one line of code, we can customize the left icon of UISearchBar and also add padding to it.

现在只需一行代码,我们就可以自定义UISearchBar的左侧图标,并为其添加填充。

searchBar.setLeftImage(UIImage(named: "dark mode")!, with: 20)
Image for post
Output: UISearchBar with padding
输出:带有填充的UISearchBar

谢谢您的阅读 (Thank You for Reading)

I hope this article helps you. Do share your valuable feedback.

希望本文对您有所帮助。 分享您的宝贵意见。

其他文章 (Other Articles)

翻译自: https://medium.com/better-programming/how-to-add-left-padding-to-a-uisearchbar-2406bcaf9271

oracle左填充

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值