How to recreate "Now Playing" button from iPod.app

My app has 4 Tabs and 3 of these Tabs also has navigation on top. I want to add a NowPlaying button to the top right of the navigation just like iPod.app. I have a class called SoundMachineViewController. This is where I have created my AVPlayer to play a remote mp3. If I went to one of my Tabs and selected a Track, my app would launch SoundMachine and starts playing the track. But if I decide to browse around, for example Tab3, I want to be able to go back to the currently playing track and rewind or something. I would click on the "Now Playing" button to get back to my SoundMachineViewController. But right now it would just create a new SoundMachine. Instead of going to the current one.

How do I keep the same currently playing track? I did some research and I think singleton is the answer. But how do I go about converting my SoundMachineViewController to a singleton class? Can someone be kind enough to provide some code examples? Or at least explain the concept how on to accomplish my goal so I can research some more or try it out?

And would I just keep this action to my Now Playing button?

- (IBAction)ButtonClicked:(id)sender { if (self.nowPlayingView == nil) self.nowPlayingView = [[[SoundMachineViewController alloc] initWithNibName:@"SoundMachineViewController" bundle:nil] autorelease]; [self.navigationController presentModalViewController:self.nowPlayingView animated:YES]; }

--------------Solutions-------------

A singleton could work for you, check out this post for the Singleton pattern implemented in Objective-C

http://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like

Category:iphone Time:2010-11-04 Views:0

Related post

  • How to create a back button with a large left-facing arrow like the iPod app 2011-07-09

    How do I create a back button with a large left-facing arrow like in the iPod app? I'm not asking how to create a left-facing button, but how to get a left-facing arrow as the label on a button, as seen in the iPod app's now playing screen: Obviously

  • Launching iPod App from Within Your Own App 2009-06-14

    Is there a way to open up the iPod app after pressing a button in your own app? Thanks. --------------Solutions------------- iPhone 3.0 SDK is still under NDA but it does include Media Player Framework (announced publicly): This framework also gives

  • ipod app replacement-in-a-tab? 2009-07-02

    With the new media-library capabilities in the 3.0 SDK, I'd like to have a tab in my application to control the music that's playing. Not just pause and play (i'm aware that pressing the home button twice brings up controls for this), but also the ab

  • Making large toolbars like the iPod app 2009-11-25

    I am trying to create a toolbar programatically (rather than via IB) very similar to the toolbar featured in the iPhone app: Currently I've been experimenting with the UIToolbar class, but I'm not sure how (and if?) you can make the toolbar buttons c

  • Searching with UISearchBar in UITableView like iPod App 2009-11-29

    I am working on making a search bar above the UITableView, like in the iPod App or Mail app. In the iPod App when you start to type in the search bar the navigation controller disappears and the UISearchBar goes to the top. The animation hasn't been

  • Want to display and implement rating as in ipod app 2010-02-04

    I want to display and implement the rating in the way apple does in the ipod app. Can anybody tell me how it is done. The code that i want to implement is to be written in a viewController. Thanks in advance. Providing the code would be useful. I am

  • Nike + iPod app like customisation? 2010-05-20

    I am very much curious about Nike + iPod app look and feel. They have selected uitabbar buttons red in color The tableviewcell selection style as red in color. The disclosure indicator is also red in color. The solution in my mind for two of these is

  • ios: specific flip effect - like ipod app 2011-01-02

    So for the past 2 days i have been searching for an answer to this question and I can't seem to find one. The effect I'm trying to reproduce is better explained with a real example: on the ipod app (on any iphone) in the now playing view, when you to

  • Are there any CPU considerations while porting iPod apps to iPad? 2010-01-28

    I'm wondering what are the things to keep in mind when porting iPod apps to iPad, considering the new CPU and capabilites? Would you have recommendations for a newbie before attempting such a task? --------------Solutions------------- You should test

  • Animated status bar style transition, a la iPod app 2010-04-07

    In the iPod app, the navigation views have the default status bar style, and the Now Playing view is in the black style. The transition between them is animated with a crossfade. I want to do that. My first attempt: [UIView beginAnimations:@"whatever

  • Smooth table view like on iPod.app 2010-04-17

    Hey folks ;), Im trying to redo the table view in the ipod.app. The one with 2 labels and the cover on the left. I want the same information there. I mean the cover plus all the other MPMediaItem stuff. Everything works fine. I can build the table an

  • How would I use a button on my app to set the current URL that a WebView is showing? 2010-06-12

    How would I use a button on my app to set the current URL that a WebView is showing? --------------Solutions------------- You can get the [[UIWebView request] url] and then set it to the title of the button. UIWebView and NSUrlRequest

  • How can you play music from the iPod app while still receiving remote control events in your app? 2010-07-07

    Ok, I'm trying to let a user choose songs from their iPod library to listen to, but I still want to receive remote control notifications (headphones, lock screen osd, etc.) in my app so I can do some extra things. So far I can get either iPod music p

  • UISlider with variable scrubbing speeds (like iPod app) 2011-01-02

    Apple's iPod (Music) app has a slider (UISlider, I presume) with variable scrubbing speeds: the further away from the slider you drag vertically, the smaller the proportion of your horizontal dragging speed that is reflected in the value change of th

  • how to programmatically click on a button in running app using C# code 2011-01-16

    I want to write a C# program which will launch an .exe (this is an easy job, I know how to do it.) but now I want to add some more functionality to it. I want to take user inputs to my program and want to pass them to running .exe as a input.Also I w

  • View Html in ios/ipod Apps 2011-02-04

    Hi i want to make a few http request and generate html from within my ipod app. I hear i want a WebView to view the html as if it were a browser. So my question is how do i make the http request? How do i parse json (or xml) and how do i save/load da

  • Why the button "Go To App" can't add my app? 2011-03-05

    Why the button "Go To App" can't authenticate users to add an application? In my app I've link (on button "Go To App") like this: http://apps.facebook.com/some/ But i need link like this: http://facebook.com/dialog/oauth?client_id=someId&redirect

  • Custom iPhone UISlider to look like the iPod app volume control 2011-03-15

    So I have a UISlider which I'm customizing with some images: UIImage *stetchLeftTrack = [[UIImage imageNamed:@"slider_blue.png"] stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0]; UIImage *stetchRightTrack = [[UIImage imageNamed:@"slider_white.p

  • How to implement the iPod.app UI on the iPad 2011-04-29

    In an app I'm writing I have a need for a UI very similar to how the iPod app works on the iPad. Specifically, when you tap on Artists at the bottom of the screen of that app, and then select an Artist with more than one Album in your collection, you

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.364 (s). 13 q(s)