作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我以编程方式创建了一个 UITextField 和 UIPickerView 并设置了输入 View 的文本字段到选择器 View ,但是当我将此测试应用程序上传到使用 iPhone OS: 3.1.2 的 iphone 测试设备时,它在 [textfield setInputView:picker] 执行时崩溃,但是如果上传到 iphone 测试设备上,相同的测试应用程序可以正常工作iPhone 操作系统:4.1。请让我知道如何让它在 iphone OS:3.1.2 上工作
谢谢
UIPickerView* picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0f, 480.0f, 320.0f, 270.0f)];
picker.delegate = self;
[TestViewController addSubview:picker];
UITextField* textfield = [[UITextField alloc] initWithFrame:CGRectMake(145.0f, 97.0f, 155.0f, 29.0f)];
textfield.delegate = self;
[textfield setInputView:picker]; // Crashes on execution
[TestViewController addSubview:textfield];
最佳答案
setInputView
在 iOS 3.2 及更高版本中可用。。
要在 iOS 3.1.2 中实现此目的,
在委托(delegate)方法textFieldDidBeginEditing中代码如下,
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[textField resignFirstResponder];
[pickerView setHidden:NO];
}
关于iphone - 如何将 UITextField setInputView 设置为 UIPickerView - iphone OS :3. 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6951776/
我有 javascript 背景,这是我第一次接触 java。 我一直在关注 this guide .我有一个完全可用的键盘,现在我想开始自定义它。我要做的第一件事是在按下某个键时显示符号。 四处挖掘
我以编程方式创建了一个 UITextField 和 UIPickerView 并设置了输入 View 的文本字段到选择器 View ,但是当我将此测试应用程序上传到使用 iPhone OS: 3.1.
我是一名优秀的程序员,十分优秀!