iPhone 组合框
2016-08-23
0 0 0
暂无评分
其他
如何获取积分?
翻译 maninwest@Codeforge 作者:Dor Alon@CodeProject
我正在进行一个项目,要求将有多个组合框的安卓应用移植到原生 iPhone 应用程序中,并要求保留移植应用的外观。但是 iOS 不包含组合框控件。我想出的办法是使用UITextField,它使用 UIPickerView 而不是键盘进行输入,类似于 Safari 的 HTML 选择字段的实现。
实现
我创建了一个UIViewController 子类,包含UITextField 和箭头图像,使其看上去像是一个组合框。
用户触按 UITextField 时,会调用以下操作:
我正在进行一个项目,要求将有多个组合框的安卓应用移植到原生 iPhone 应用程序中,并要求保留移植应用的外观。但是 iOS 不包含组合框控件。我想出的办法是使用UITextField,它使用 UIPickerView 而不是键盘进行输入,类似于 Safari 的 HTML 选择字段的实现。
实现
我创建了一个UIViewController 子类,包含UITextField 和箭头图像,使其看上去像是一个组合框。
用户触按 UITextField 时,会调用以下操作:
- (IBAction)showPicker:(id)sender { pickerView = [[UIPickerView alloc] init]; pickerView.showsSelectionIndicator = YES; pickerView.dataSource = self; pickerView.delegate = self; UIToolbar* toolbar = [[UIToolbar alloc] init]; toolbar.barStyle = UIBarStyleBlackTranslucent; [toolbar sizeToFit]; //to make the done button aligned to the right UIBarButtonItem *flexibleSpaceLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem* doneBut
objective-c
iphone
组合
相关源码推荐
AT24C16软IIC驱动器
0
0
暂无评分
相机扫描库
0
1
暂无评分
iOS AES/CBC/PKCS7Padding加密、解密
0
0
暂无评分
iOS 自定义输入法
0
0
4.0分
iOS常用的宏定义
0
0
暂无评分
暂无评论