变换(旋转)UIBarButtonItem
有人知道如何转换 UIBarButtonItem 吗?
我尝试了这个但没有结果:( 它不适用于 UIBarButtonItem 及其自定义视图。
[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:5.0f]; CGAffineTransform myTransform = CGAffineTransformMakeRotation(M_PI_2); UIBarButtonItem * currentItem = [self.toolbarItems objectAtIndex:4]; currentItem.customView.transform = myTransform; [UIView commitAnimations];
我确认转换适用于其他视图(我尝试使用 self.view)。
谢谢 !
Does anybody know how to transform a UIBarButtonItem ?
I tried this but with no results :(
It's not working on both UIBarButtonItem and its customview.
[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:5.0f]; CGAffineTransform myTransform = CGAffineTransformMakeRotation(M_PI_2); UIBarButtonItem * currentItem = [self.toolbarItems objectAtIndex:4]; currentItem.customView.transform = myTransform; [UIView commitAnimations];
I confirm the transform works on other views (I tried with self.view).
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用:
use:
UIBarButtonItem 不扩展 UIView,因此无法直接转换。您可以将要转换的 UIBarButtonItem 添加到 UIToolbar,转换 UIToolbar,然后将工具栏作为自定义视图添加到另一个 UIBarButtonItem。然后可以将此项目设置为导航项目或添加到另一个 UIToolbar。
UIBarButtonItem does not extend UIView, so it cannot be transformed directly. You can add the UIBarButtonItem you wish to transform to a UIToolbar, transform the UIToolbar and then add the toolbar as a custom view to another UIBarButtonItem. This item can then be set as a navigation item or added to another UIToolbar.