创建一个导航按钮,如 iPod 的“正在播放”按钮按钮
在 iPod 应用程序中,有一个朝右的导航按钮以及通常朝左的“后退”按钮。它会让您返回“正在播放”屏幕。这是一个自定义按钮,还是有一种方法可以使用标准工具轻松创建一个按钮?
替代文本http://img.skitch.com/20100513-m9b9g67ftfh8bisgbj3mib9sex.jpg
In the iPod app, there's a right-facing navigation button as well as the usual left-facing "Back" button. It gets you back to the "Now Playing" screen. Is this a custom button, or is there a way to easily create one using standard tools?
alt text http://img.skitch.com/20100513-m9b9g67ftfh8bisgbj3mib9sex.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信在 SDK 中不可能。解决方法是在 Dashcode 中创建按钮(在聚光灯下搜索“dashcode”)。在“Mobile Safari”视图中,只需拖入“前进按钮”即可。然后,您可以使用 Dashcode 检查器为图像重新着色。在Finder中找到Dashcode项目,右键单击它并转到“显示包内容”,按钮图像应位于图像目录下(项目>移动>部件>图像)。
然后,您可以简单地将按钮作为自定义图像 UIBarButtonItem 添加到导航栏 (self.navigationItem.rightBarButtonItem = ...);
示例 http://img6.imageshack.us/img6/5372/screenshot20100515at220.png
Not possible in the SDK I believe. A workaround would be to create the button in Dashcode (search "dashcode" in the spotlight). In the "Mobile Safari" view, just drag in a "Go Forward Button". You can then recolour the image using Dashcode inspector. Find the Dashcode project in Finder, right click it and go to "Show Package Contents", the button images should be under the image directory (Project > mobile > Parts > Images).
Then you can simply add the button to your Nav bar as an custom image UIBarButtonItem (self.navigationItem.rightBarButtonItem = ...);
Example http://img6.imageshack.us/img6/5372/screenshot20100515at220.png
Last.fm 应用程序有执行此操作的代码。查看
UIViewController+NowPlayingButton.m
中的showNowPlayingButton:
。效果就像一个魅力! :)https://github.com/c99koder/lastfm-iphone
The Last.fm app has code to do this. Look at
showNowPlayingButton:
inUIViewController+NowPlayingButton.m
. Works like a charm! :)https://github.com/c99koder/lastfm-iphone