请我有时间这个问题不解决创立和adressing您为:)机械手尚未显示
我有UIPickerView它必须从视图的底部显示,当用户点击在为UITextField(这是我的应用程序的要求强迫我做的),所以我实现这个方法来捕捉文本字段的触摸事件:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch;
touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
if(CGRectContainsPoint([typeCarburantTextField frame],point))
{
[self pickerTypeCarburantsShow];
}
}
这种方法来防止键盘被显示在用户的时候点击文本字段:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
return NO;
}
pickerTypeCarburantsShow
-(IBAction)pickerTypeCarburantsShow{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
CGAffineTransform transform=CGAffineTransformMakeTranslation(0, 240);
pickerViewTypesCarburants.transform=transform;
[self.view addSubview:pickerViewTypesCarburants];
[UIView commitAnimations];
}
我所有的IB连接都还不错,但是当我运行,我点击的UITextField键盘不会出现,但我没有看到选择器显示 pleaaaase帮助,thx预先:)
嗨,我的视图的名称,其中包含选择器是“pickerViewTypesCarburants”。应该变成这样:@property(readwrite,retain)UIView * pickerViewTypesCarburants ??并为合成?另外,我不明白你的第二个陈述,应该是textView,不应该是pickerViewTypesCarburants视图? – Malloc 2011-04-17 19:34:23
我已编辑答案...让我知道如果你需要它澄清 – govi 2011-04-17 19:40:01
所以..如果我正确理解它,它将textView.inputView = [自我pickerViewTypesCarburants],考虑到uitextfield被称为文本视图 – govi 2011-04-17 19:40:54