UIToolbar 中的 UISegmentedControl

发布于 2024-12-23 17:07:07 字数 359 浏览 3 评论 0原文

我正在将一个应用程序从 iOS 4 迁移到 iOS 5,但我发现自己陷入了困境。这是我的问题:

我有一个 UIToolbar ,其中有一个 UISegmentedControl 。现在,在旧的应用程序中,我使用了 UISegmentedControl 的所有方法,

[switch removeAllSegments];

但这会导致在新的 iOS 5 中崩溃,因为现在 UISegmentedControl 会在 中自动转换>UIBarButtonItem。 我该如何解决这种情况?

I'm migrating an App from iOS 4 to iOS 5 and I find myself stuck. Here's my problem:

I have a UIToolbar that has a UISegmentedControl within. Now, with the old App, I used all the methods of UISegmentedControl, like

[switch removeAllSegments];

but this leads to crash in the new iOS 5 because now the UISegmentedControl is automatically converted in UIBarButtonItem.
How can I solve this situation?

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

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

发布评论

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

评论(1

耳根太软 2024-12-30 17:07:07

这可能不是最佳实践。但我认为你必须在 UIToolbar 上添加子视图,并在该子视图中添加分段控件。愿它对你有用。

This may not best practice. But i think you have to add subview on UIToolbar and in that subview please add segmented controls. May it work for you.

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