Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6025361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:17:23+00:00 2026-05-23T04:17:23+00:00

I’m building an iPhone app that loads 5 items on a TabBarController. When the

  • 0

I’m building an iPhone app that loads 5 items on a TabBarController.

When the app loads the first view is an audio player (an instance of MyAudioPlayerViewController)

Suppose the user starts to play a song on MyAudioPlayerViewController and then decides to tap on the second Tab Bar Item, which has 6 options on a UITableView to choose from. The user makes a selection, that leads to another UITableView (with some other options to choose from), then they make another selection, leading to a final ViewController, that is an audio player as well.

I need this final UIViewController to be the SAME as the first one that had the inicial song playing and NOT a new instance of MyAudioPlayerViewController.

Why do I need this configuration? I need it because in the very moment that the user makes his final selection on the previous UITableView the song that is playing MUST STOP.

This final view having the MyAudioPlayerViewController must be able the access my custom NSObject class that is playing the audio, making it stop the current song.

Right now I have this code that is invoking MyAudioPlayerViewController that shows the final UIViewController:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    MyAudioPlayerViewController * myAudioPlayerViewController = [[MyAudioPlayerViewController alloc] initWithNibName:@"MyAudioPlayerViewController" bundle:nil];
    [self.navigationController pushViewController:myAudioPlayerViewController animated:YES];   
    [myAudioPlayerViewController changeText:[arraySingerList objectAtIndex:indexPath.row] withSong:[arraySongList objectAtIndex:indexPath.row]];    
    [myAudioPlayerViewController release];    
} 

As you can see it makes a new instance of MyAudioPlayerViewController, that has nothing to do with the very first one when app launched, then I’m able to invoke the method on my custom NSObject class (the player itself) responsible to stop the previous audio that is playing because it is protected.

Is there any solution for this case or should I build everything again using another approach?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:17:24+00:00Added an answer on May 23, 2026 at 4:17 am

    You need to be able to reference the MyAudioPlayerViewController instance from your other classes. You can do this through your app delegate if you like.

    If your tab bar controller is set up using Interface Builder, create an IBOutlet in your app delegate of class MyAudioPlayerViewController and hook it up to your MyAudioPlayerViewController in Interface Builder.

    If you’re setting up the tab bar controller in code, simply alloc/initialize the instance variable and set it as your first tab.

    You’ll need to either set its properties or create an accessor method so you can access it from other classes.

    To set up the property, open up your app delegate .h file and add this:

    @property (nonatomic, retain) IBOutlet MyAudioPlayerViewController *myAudioPlayerViewController;
    

    and in your app delegate .m file add this:

    @synthesize myAudioPlayerViewController;
    

    Then:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
        YourAppDelegate *yourAppDelegate = (YourAppDelegate *)[UIApplication sharedApplication] delegate];
        MyAudioPlayerViewController * myAudioPlayerViewController = [yourAppDelegate myAudioPlayerViewController];
        [self.navigationController pushViewController:myAudioPlayerViewController animated:YES];   
        [myAudioPlayerViewController release];    
    } 
    

    For more info about properties in Objective-C: http://cocoacast.com/?q=node/103

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.