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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:51:35+00:00 2026-05-23T20:51:35+00:00

I want to package some UIViews suchs as UIButton, UIImageView in a single UIView.

  • 0

I want to package some UIViews suchs as UIButton, UIImageView in a single UIView.
When I try to display that view, it is not showing up on my RootViewController:

Here is the code of my UIView subclass :

#import "Hover.h"

@implementation Hover


- (id)init{
    self = [super init];
    if (self) {
        // Initialization code
        UIImage *hover = [UIImage imageNamed:@"Hover.png"];
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.image = hover;
        imageView.frame = CGRectMake(0, 0, hover.size.width, hover.size.height);
        imageView.alpha = 0.75;
        [self addSubview:imageView];
        [imageView release];
    }
    return self;
}

And here is the RootViewController class:

- (void)viewDidLoad
{

    Hover *hover = [[Hover alloc] init];
    [self.navigationController.view addSubview:hover];
    [hover release];


    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

The “hover view” is not displayed! However, when I add a single UIImageView to my RootViewController, it works!

  • 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-23T20:51:36+00:00Added an answer on May 23, 2026 at 8:51 pm

    In order for your view to display, you should override the -(id)initWithFrame:(CGRect)frame;, instead of writing a custom initializer.

    Try this way :

    -(id)initWithFrame:(CGRect)frame {
        self = [super initWithFrame:frame];
        if(self) {
            // do init here...
        }
        return self;
    }
    

    Also, in the -(void)viewDidLoad; method, first send [super viewDidLoad];, and then alloc/init the view.

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

Sidebar

Related Questions

If I'm not online, I sometimes want to package some changes to a commit,
I want to make a component that uses some resources compiled in my package's
I want to package a piece of code that absolutely must run on Java
I want to package a Python script so that it can run as a
I want to write some python package installing script in Python into virtualenv. I
I have some package of javadoc, and I want to extract a list of
I want to import some package depending on which value the user chooses. The
In my app I have some package under src/, like packagename/dtd, which I want
I have an SSIS package that transfers some tables to CSV files on a
I want to emulate some human(not for spam use) for some my daily works.

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.