Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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-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

like image 843
nevan king Avatar asked May 13 '10 13:05

nevan king


People also ask

How do I add a button to my navigation bar?

Example ExplainedUse any element to open the dropdown menu, e.g. a <button>, <a> or <p> element. Use a container element (like <div>) to create the dropdown menu and add the dropdown links inside it. Wrap a <div> element around the button and the <div> to position the dropdown menu correctly with CSS.


2 Answers

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

like image 181
Jamie Chapman Avatar answered Sep 30 '22 10:09

Jamie Chapman


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

like image 38
Donald Burr Avatar answered Sep 30 '22 11:09

Donald Burr