我需要知道日期选择器是否可以在点击按钮时显示为警报视图。到目前为止,我已经在viewdidload方法中隐藏了日期选择器,并在按钮的方法中设置了hidden = no。
我打算将日期存储在核心数据中。
答案 0 :(得分:2)
创建pickerView,将其放在视图边界之外,将其添加为子视图并使用动画将其向上滑动。像下面这样的东西应该有用......
CGRect frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 215);
UIPickerView *typePicker = [[UIPickerView alloc] initWithFrame:frame];
[self.view addSubview:typePicker];
[UIView beginAnimations:@"slideIn" context:nil];
[typePicker setCenter:CGPointMake(typePicker.center.x, self.view.frame.size.height - typePicker.frame.size.height/2)];
[UIView commitAnimations];
答案 1 :(得分:0)
您将日期选择器放在子视图中,然后单击按钮显示子视图。您可能希望子视图从侧面或底部滑入。