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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:44:53+00:00 2026-06-13T03:44:53+00:00

I created this view controller which has a XIB file, and contains a UIButton

  • 0

I created this view controller which has a XIB file, and contains a UIButton.
I alloc and init the controller, and add the view to the superview:

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.vc = [[MyViewController alloc]init];
    [self.view addSubview:self.vc.view];
    CGRect frame;
    frame.size.height = 200;
    frame.size.width = 200;
    frame.origin.x = 100;
    frame.origin.y = 100;
    self.vc.view.frame = frame;
    [vc setText:@"123"];
}

When I run this, the UIButton is not shown. When I debug this, and put breakpoints in my controller’s viewDidLoad or viewDidAppear, the UIButton is always uninstantiated (memory adress 00000000);

what can be the problem?

  • 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-13T03:44:54+00:00Added an answer on June 13, 2026 at 3:44 am

    Your MyViewController should be initialised with the XIB file:

    ...
    self.vc = [[MyViewController alloc] @"MyViewController" bundle:nil];
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a button on my view controller which has a predefined background image.
I have a Table View Controller which I have designed using storyboards. This has
I created a partial view, abc in my Views/Home added this to my controller
I have a xib-file with a small UIView on it, which in turn contains
I created a window application, which has a tabbar controller with four tabbar items.
I have a TabBar which has been created programmatically. In the view controllers of
I have a UITableView on a view. This UITableView has cells which are made
Overview I have a iOS project in which the view controller implementation which has
I created a custom view, which has one button and one text field ,
I have created a controller class named TAddAlarmController which has a tableview which consists

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.