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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:49:13+00:00 2026-05-25T11:49:13+00:00

I am taking a programming class (for noobs) and I need to create the

  • 0

I am taking a programming class (for noobs) and I need to create the UIViewController graphViewController‘s view programmatically (without interface builder).

The view is simple, it only consists of an IBOUtlet which is an instance of a UIView subclass called GraphView. graphView responds to several multitouch gestures for zooming and panning and what-not, but I handle all of that stuff in - (void)viewDidLoad.

I am doing just the creation of the self.view property and graphView in the code below:

- (void)loadView
{
    UIView *gvcView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    self.view = gvcView;
    [gvcView release];

    GraphView *aGraph = [[GraphView alloc] initWithFrame:self.view.bounds];
    self.graphView = aGraph;
    [aGraph release];

}

When I run the app I do not see the graphView view in there. I just get a transparent view which shows the “My Universal App” label. I’m stumped. Please help.

Let me know if you need additional code.

Thanks!

Update: Big thanks to BJ Homer for the quick fix!

had to do the following:

add this line of code: [self.view addSubview:self.graphView]; at the end.

I was also getting this strange bug where graphView was showing up as completely black. This line of code fixed that: self.graphView.backgroundColor = [UIColor whiteColor];

And that’s it!

Final question: Is the default background color black for a custom UIView?

Thanks again!

  • 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-25T11:49:13+00:00Added an answer on May 25, 2026 at 11:49 am
    [self.view addSubview:self.graphView];
    

    Until you add your graph view to a parent view, UIKit doesn’t know where to display it. self.view is special, since that’s the property that -loadView is supposed to set. That view will automatically be added to the screen. But your graph view is just floating off in the ether until you add it somewhere.

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

Sidebar

Related Questions

I'm a blind college student who is taking an introduction to programming class that
I am taking a class in C++ programming and the professor told us that
I am taking my first foray into PHP programming and need to configure the
I am only allowed to use private members in the programming course I'm taking,
I am taking a principals of programming class right now. We are learning about
Hey. I'm taking a course titled Principles of Programming Languages, and I need to
I'm currently taking a class on programming the iPhone, and I am struggling with
I am taking a programming class and we are required to use the gcc
I am taking a C++ programming class right now on GIS Programming. I am
I am currently taking a parallel programming class and our first programming exercise was

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.