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

  • SEARCH
  • Home
  • 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 4123684
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:38:34+00:00 2026-05-20T23:38:34+00:00

I have a View based application for iPhone/iPod that plays audio, having a VU

  • 0

I have a View based application for iPhone/iPod that plays audio, having a VU meter showing the input dB level. This VU meter is animated using Core Animation.

The app runs fine, with the VU meter working great, having just one single View. But now, sadly, that I have inserted a Tab bar controller, to have another View with some internet content, I can’t get the VU meter to work on my first View, as before.

The app crashes (receiving the EXC_BAD_ACCESS message) because the UIView (that contains the VU meter .png file for Core Animation) is not being properly inserted during launching time as it did before as a View only application.

Here is my code, in the myAppDelegate.m file:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

PlayerViewController *newController = [[PlayerViewController  alloc] initWithNibName: @"PlayerView"
                                                                        bundle: [NSBundle mainBundle]]; 
self.viewController = newController; 
[newController release];

UIView *controllerView = [self.viewController view]; 
[self.window addSubview: controllerView];
[self.viewController addBargraphToView: controllerView];
[self.window makeKeyAndVisible]; 


 self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];

return YES;

}

And here is my PlayerViewController.m file, where I have the addBargraphToView method containing my image to be inserted. It remains invisible until the VU meter starts working:

- (void) addBargraphToView: (UIView *) parentView {

// static image for showing average level
UIImage *soundbarImage      = [[UIImage imageNamed: @"vu-meter.png"] retain];


// background colors for generated image for showing peak level
self.peakClear              = [UIColor clearColor]; 
self.peakGray               = [UIColor lightGrayColor];  
self.peakOrange             = [UIColor orangeColor];  
self.peakRed                = [UIColor redColor];  

levelMeter                  = [CALayer layer];
levelMeter.anchorPoint      = CGPointMake (0.0, 20.0);                      // anchor to halfway up the left edge
levelMeter.frame            = CGRectMake (15, 200, 0, kLevelMeterHeight);   // set width to 0 to start to completely hide the bar graph segements
levelMeter.contents         = (UIImage *) soundbarImage.CGImage;

peakLevelMeter              = [CALayer layer];
peakLevelMeter.frame        = CGRectMake (41, 233, 0, kLevelMeterHeight);
peakLevelMeter.anchorPoint  = CGPointMake (0.5, 10.0);
peakLevelMeter.backgroundColor = peakGray.CGColor;

peakLevelMeter.bounds       = CGRectMake (0, 0, 0, kLevelMeterHeight);
peakLevelMeter.contentsRect = CGRectMake (0, 0, 1.0, 1.0);

[parentView.layer addSublayer: levelMeter];
[parentView.layer addSublayer: peakLevelMeter];

[soundbarImage release];

}

How can I solve this problem? Should I insert the UIView image at some other point, and not during the application’s launch time?

Many thanks for your help, dear friends!

  • 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-20T23:38:35+00:00Added an answer on May 20, 2026 at 11:38 pm

    Move this call:

    [self.viewController addBargraphToView: controllerView];
    

    To -viewDidLoad inside your PlayerViewController implementation:

    - (void) viewDidLoad 
    {
        [super viewDidLoad];
        [self addBargraphToView: self.view];
    }
    

    Edit

    OK, I think the problem lies in double adding viewControllers. Make this the content of your application:didFinishLaunchingWithOptions: method:

    PlayerViewController *newController = [[PlayerViewController  alloc] initWithNibName: @"PlayerView"
                                                                            bundle: [NSBundle mainBundle]]; 
    self.viewController = newController;
    [newController release];
    
    self.tabBarController.viewControllers = [NSArray arrayWithObjects: newController, yourInterntContenViewController, nil];
    
    [self.window addSubview: self.tabBarController.view];
    [self.window makeKeyAndVisible];
    
    return YES;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an iPhone application based on an OpenGL view. Now I would
I am new to iphone development.I have created a view based application.Now i want
I have a view user control that can post form. This control can be
I have create a view based application and its loaded correctly what i designed
I've got a sample application on http://github.com/niklassaers/Test-iPhone-TabBar-App that shows my problem: I have a
I Have a normal view based application and have added an UITabBar component. I
I have a Monthly Status database view I need to build a report based
We have a View (call it X) that is the base view called by
I have a view that has a list of jobs in it, with data
I have a view using a master page that contains some javascript that needs

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.