UIBarButtonItem 中的 UISlider 影响动画行为

发布于 2024-08-11 09:59:27 字数 598 浏览 2 评论 0原文

在 IB 中,我使用 UIToolBar 设置了一个视图 MyView,然后在其上放置了一个 UISlider。 IB 自动将其嵌入到 UIBarButtonItem 中,并使用 UISlider 设置其视图。

我在带有动画的导航控制器中显示此 MyView。

UIViewController *myVC = [[UIViewController alloc] initWithNibName:@"MyView" bundle:nil];
[self.navigationController PushViewController:myVC 动画:YES];
[myVC release];

MyView 已显示,但没有动画。除此之外,一切正常,我可以根据需要使用 UISlider。 如果我从工具栏中删除 UISlider 或者将 UISlider 放入视图本身而不是工具栏中,则 MyView 将以动画显示。 我已经尝试使用 UIProgressView 进行相同的操作,并且效果很好(视图以动画显示)。看来 UISlider 作为 UIBarButtonItem 的 customView 会阻止动画。 我还检查了是否有任何可能的泄漏。

有什么想法吗? 谢谢 酸。

In IB, I set a view MyView with an UIToolBar and I drop an UISlider on it. IB automatically embeds it in an UIBarButtonItem and sets its view with the UISlider.

I display this MyView in a navigation controller with animation.

UIViewController *myVC = [[UIViewController alloc] initWithNibName:@"MyView" bundle:nil];
[self.navigationController pushViewController:myVC animated:YES];
[myVC release];

MyView is displayed but without animation. Apart from that, everything works fine, I can use the UISlider as needed.
If I remove the UISlider from the toolbar or if I put the UISlider in the view itself, not in the toolbar, MyView is displayed with animation.
I have tried the same with an UIProgressView instead and it worked fine ( view is displayed with animation ). It seems that UISlider as customView of an UIBarButtonItem prevents the animation.
I have also checked for any possible leaking.

Any idea ?
Thanks
Tart.

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

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

发布评论

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

评论(1

追风人 2024-08-18 09:59:27

我遇到了完全相同的问题。我将使用 UISlider 打开视图,从那时起,我的应用程序中的任何视图转换都不会被动画化。

我最终用通用 UIView 替换了 UIToolBar(听起来您已经成功尝试过此操作)。您始终可以通过捕获空工具栏的图像并将其用作视图中的背景来伪造 UIToolBar 外观。

I ran into exactly the same issue. I would open the view with the UISlider and from that point on, none of the view transitions in my application would be animated.

I ended up replacing the UIToolBar with a generic UIView (sounds like you've already tried this with success). You could always fake the UIToolBar look by capturing an image of an empty toolbar and using that as the background in your view.

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