我的UIPickerView工作完美。显然我对它的行为感到困惑 - 如果我保持在代码之下我的选择器仍然可见(这正是我想要的)
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
NSLog(@"=====");
}
现在,如果我只有一行选择器自动隐藏,我的按钮标题标签也会设置为适当的值。
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
[MyButtonObj setTitle:myarray[row] forState:UIControlStateNormal];
}
我无法理解为什么设置按钮标题会自动隐藏uipickerview
。
点击按钮我正在使用查看动画显示选择器视图。
if (!isPickerDisplay)
{
[UIView animateWithDuration:0.25 animations:^{
CGRect temp = _ownPickerView.frame;
temp.origin.y = self.view.frame.size.height - _ownPickerView.frame.size.height;
_ownPickerView.frame = temp;
}
completion:^(BOOL finished)
{
NSLog(@"picker displayed");
isPickerDisplay = YES;
}];
}