开发者

Create a navigation button like the iPod "Now Playing" button

In the iPod app, there's a right-facing navigation button as well as the usual left-fac开发者_JAVA百科ing "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


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


The Last.fm app has code to do this. Look at showNowPlayingButton: in UIViewController+NowPlayingButton.m. Works like a charm! :)

https://github.com/c99koder/lastfm-iphone

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜