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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:49:29+00:00 2026-06-12T06:49:29+00:00

In the initialization method for a UIView subclass I am adding several UIImageViews .

  • 0

In the initialization method for a UIView subclass I am adding several UIImageViews. When the view is rendered they are present in the subviews array and have valid frame rects, but are not drawn on the screen. Does anyone know why this happens?

- (id) initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];
    if (!self)
        return nil;

    [self commonInit];

    return self;

}

- (void) commonInit {

    _padding = 128.0f;

    // Add the chord views here


    _chordImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"fn_maj_x_x_x_x_1_e_1_fn"], [UIImage imageNamed:@"en_maj_x_x_x_x_1_e_1_en"], [UIImage imageNamed:@"dn_maj_x_x_x_x_1_d_1_f#"], [UIImage imageNamed:@"an_min_x_x_x_x_1_a_1_en"], nil];

    CGFloat containerWidth = [self bounds].size.width;
    NSLog(@"containerWidth: %f",containerWidth);
    CGFloat chordWidth = [[_chordImages objectAtIndex:0] size].width;
    NSLog(@"chordWidth: %f",chordWidth);
    CGFloat chordMarkerWidth = [[[GVChordMarkerView alloc] initWithFrame:CGRectMake(0, 0, 12, 12)] frame].size.width;
    NSLog(@"chordMarkerWidth: %f",chordMarkerWidth);

//  [self setFrame:CGRectMake(chordXPosition, 0, [self bounds].size.width, [self bounds].size.height]);

    CGFloat chordXPosition = 0;
    CGFloat chordXSpacing = (containerWidth/4 - (chordMarkerWidth + chordWidth));
    chordXPosition += containerWidth/4;

    for (NSUInteger i = 0; i < [_chordImages count]; i++) {
        chordXPosition += chordXSpacing;
        CGRect chordImageViewFrame = CGRectMake(chordXPosition, 0, [[_chordImages objectAtIndex:0] size].width, [[_chordImages objectAtIndex:0] size].height);
        UIImageView *chordImageView = [[UIImageView alloc] initWithFrame:chordImageViewFrame];
        [self addSubview:chordImageView];
        chordXPosition += (chordMarkerWidth + chordWidth);
    }
    NSLog(@"Finished");
}
  • 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-06-12T06:49:30+00:00Added an answer on June 12, 2026 at 6:49 am

    Could it be that your UIImageview is just empty? Where did you add the image?

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

Sidebar

Related Questions

I have a method in my UIView subclass Card to dismiss an instance by
I´m getting a lazy initialization exception. A have a controller method with the annotation
C++ Notes: Array Initialization has a nice list over initialization of arrays. I have
I have tried to cast an implementation of my UIView class to my view
My application has a view controller that extends UITableViewController . The initialization method looks
Inside an initialization method, I have the following code - (id)init { self =
I'm creating a custom subclass of UIView. I'm currently doing initialization based on Objective
I have a subclass of UIView that's instantiated in a XIB file. I need
I have a UIView subclass which in turn has a contentView, declared as such
I have a class that has an explicit initialization method and some other methods

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.