我只是试图解决UIPickerView
- 导航栏上的按钮或选择器视图上方工具栏上的“完成”按钮。我已经实现了这两个按钮,并且我正在尝试解除选取器视图并退出第一响应者。UIToolBar上的Done按钮解除UIPickerView
如何使用工具栏上的“完成”按钮来解除UIPickerView
?
这是我的UIToolBar
代码:
UIToolbar* keyboardDoneButtonView = [[UIToolbar alloc] init];
keyboardDoneButtonView.barStyle = UIBarStyleBlack;
keyboardDoneButtonView.translucent = YES;
keyboardDoneButtonView.tintColor = nil;
[keyboardDoneButtonView sizeToFit];
UIBarButtonItem* doneButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleBordered target:self
action:@selector(pickerDoneClicked:)] autorelease];
[keyboardDoneButtonView setItems:[NSArray arrayWithObjects:doneButton, nil]];
textField.inputAccessoryView = keyboardDoneButtonView;
有人能帮助我吗?
没有尝试过这个自己:到底什么是你的问题/问题? pickerView不会消失吗?如果这不起作用,你可以手动向下动画并调用removeFromSuperview,我猜。那有意义吗? –
如果可能的话,我会尝试并复制它。如果我可以得到一个工作代码,我会分享我与你有什么 – justin
@slev:谢谢你。 – Legolas