将工具栏添加到选择器视图

发布于 2024-09-05 02:29:35 字数 127 浏览 2 评论 0原文

我如何能够将工具栏添加到选择器? 我希望在选择器上方有一个带有“完成”栏按钮项目的工具栏。单击“完成”按钮将隐藏(动画)屏幕外的选择器(像键盘一样转到底部)

我仍在寻找此操作方法...希望你能帮助我。

谢谢

How I could able to add a toolbar to the picker?
I want above the picker there is a toolbar with a "done" bar button item. clicking the "done" button will hide (animate) the picker offscreen (going to bottom like the keyboard)

I'm still looking for this how-to... Hope you could help me.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千纸鹤 2024-09-12 02:29:35

当我需要这样做时,我通常会创建一个容器视图并将选择器和工具栏放入其中。这允许分组作为一个单元被隐藏、移动、调整大小等。

UIView *pickerGroupView = [[[UIView alloc] initWithFrame: frame] autorelease];
thePicker.frame = pickerGroupView.bounds;
[pickerGroupView addSubview: thePicker];

theToolbar.center = pickerGroupView.center;  // assuming that's where you want it
[pickerGroupView addSubView: theToolbar];

When I need to do this, I typically make a container view and place into it both the picker and the toolbar. This allows the grouping to be hidden, moved, sized, etc as a unit.

UIView *pickerGroupView = [[[UIView alloc] initWithFrame: frame] autorelease];
thePicker.frame = pickerGroupView.bounds;
[pickerGroupView addSubview: thePicker];

theToolbar.center = pickerGroupView.center;  // assuming that's where you want it
[pickerGroupView addSubView: theToolbar];
深海蓝天 2024-09-12 02:29:35

最简单的方法是创建一个新的 UIToolbar,并将其放置在选择器视图的正上方,当您对其进行动画处理时。请查看 DateCell 动画代码示例。

The easiest way would be to make a new UIToolbar and position that directly above your picker view when you animate it in. Check out the DateCell example for animation code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文