gpt4 book ai didi

ios - 带有下拉按钮的 UITextField

转载 作者:行者123 更新时间:2023-11-28 19:56:51 25 4
gpt4 key购买 nike

UITextField 可以单独使用代码来实现这个 UI,还是我需要为此使用图像或其他组件?像按钮,标签。

screenshot

最佳答案

试试这个。

UIImageView *imgViewForDropDown = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 35, 35)];
imgViewForDropDown.image = [UIImage imageNamed:@"dropDown.png"];
yourTextField.rightView = imgViewForDropDown;
yourTextField.rightViewMode = UITextFieldViewModeAlways;

对于 Swift 代码:

let imgViewForDropDown = UIImageView()
imgViewForDropDown.frame = CGRect(x: 0, y: 0, width: 30, height: 48)
imgViewForDropDown.image = UIImage(named: "ic_keyboard_arrow_down_white")
yourTextField.rightView = imgViewForDropDown
yourTextField.rightViewMode = .always

关于ios - 带有下拉按钮的 UITextField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26011639/

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