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 6580351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:01:02+00:00 2026-05-25T16:01:02+00:00

I originally added an MPVolumeView dynamically on to a page… #import MediaPlayer/MPVolumeView.h . .

  • 0

I originally added an MPVolumeView dynamically on to a page…

#import "MediaPlayer/MPVolumeView.h"
.
.
-(IBAction) handleVolumeButtonClicked:(id) sender {
    if (volumeView == nil) {
        volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(25, 378, 270, 30)];
        [self.view addSubview:volumeView];
        [volumeView release];
    } else {
        [volumeView removeFromSuperview];
        volumeView = nil;
    }
}

But for some reason I started getting reports of the application crashing when dynamically adding the volume component.

To work around this, I decided to try and add the component to the view via the XCode designer, but then I realised that I didn’t know how to do this!

I dragged an ‘Object’ from the template to the Object palette first, but then I found that I couldn’t add it to the view. So I scrapped that idea and then dragged the ‘View’ object directly on to the .xib view.

Once the component was added, I tried to change the ‘Custom Class’ to ‘MPVolumeView’, but the view just rendered an empty rectangle. Running the code in the simulator failed to render anything.

Does anyone know what steps I am missing to add a class to the view that doesnt already exist in the palette?

  • 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-25T16:01:03+00:00Added an answer on May 25, 2026 at 4:01 pm

    Not sure if you have figured this out by now. I just created an app with a volume slider successfully. Here’s what I did (from MPVolumeView):

    • Added a UIView and sized and positioned it as desired into the .xib view.
    • Changed the Class to MPVolumeView
    • Added the following to my .h file:
    #import 
    
    @interface MyView : UIViewController {
        MPVolumeView *_mpVolumeViewParentView;
    }
    @property (nonatomic, retain) IBOutlet MPVolumeView *mpVolumeViewParentView;
    
    @end
    • Added the following to my .m file:
    #import "MyView.h"
    
    @implementation MyView
    
    @synthesize mpVolumeViewParentView = _mpVolumeViewParentView;
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        [[self mpVolumeViewParentView] setBackgroundColor:[UIColor clearColor]];
        MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame:[[self mpVolumeViewParentView] bounds]];
        [[self mpVolumeViewParentView] addSubview:myVolumeView];
        [myVolumeView release];
    }
    - (void)dealloc {
        [_mpVolumeViewParentView release];
        [super dealloc];
    }

    Hope it helps.

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

Sidebar

Related Questions

I have a page with some dynamically added buttons. If you click a button
I had a bunch of images in my Xcode project. They were originally added
I added a box-shadow to a section of a page recently to give it
I'm trying to figure out a bug I have. Originally, my coworker just added
I have added a service reference to my asp.net web application (originally it was
I originally wrote my Wordpress 3.0 widget http://codex.wordpress.org/Widgets_API for editing on the widget page
Originally there was the DAL object which my BO's called for info and then
Originally I thought to ask if there would be an easy way to provide
Originally I though I'll just take a screenshot of my app on the iPhone
Originally I had a design problem where I needed five subclasses of a superclass,

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.