UIToolbar 中的 UISegmentedControl
我正在将一个应用程序从 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能不是最佳实践。但我认为你必须在 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.