增加搜索栏中图标和光标之间的间距 Objective-C

Increase spacing between icon and cursor in search bar Objective-C

增加搜索栏中图标和光标之间的间距

所以我想在 searchIcon 和用户输入的文本之间添加一个 space,因为它们彼此太靠近了。

看看 Apple 的 UISearchBar Class Reference 并寻找 searchTextPositionAdjustment

要在图标和文本之间创建 10 像素的间隙,您可以在代码中执行以下操作: searchBar.searchTextPositionAdjustment = UIOffsetMake(10.0f, 0.0f);