gpt4 book ai didi

ios - UISearchbar 占位符错位

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:03:46 24 4
gpt4 key购买 nike

我在 xib 中有一个 UISearchbar 并且占位符不在完美设计中。

见图片enter image description here

最佳答案

UITextField *txtField = [UITextField appearanceWhenContainedIn:[UISearchBar class], nil];
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 8, 20)];
paddingView.backgroundColor = [UIColor grayColor];
[txtField setLeftViewMode:UITextFieldViewModeAlways];
[txtField setLeftView:paddingView];
txtField.delegate = self;
[txtField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
txtField.textAlignment = UITextAlignmentLeft;

关于ios - UISearchbar 占位符错位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26031729/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com