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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:10:01+00:00 2026-06-11T05:10:01+00:00

I am new to IOS programming. I am starting from the basic application created

  • 0

I am new to IOS programming. I am starting from the basic application created by XCode 4.3 (SingleView application).
Continuing from my above question, I was able to add Views programmaticaly to the main ViewController in the Appdelegate but If I want to do the same after the view has loaded (inside viewDidLoad), I am facing the trouble. I tried using the same logic of adding subviews but I am not sure if the view needs a refresh after adding inside ‘viewDidLoad’

My views are very simple, here is the code

-(void)viewDidLoad
{

[super viewDidLoad];
UIBUtton *btn = [UIBUtton] alloc] initWithFrame:CGRect(10,10,50,50)];
[self.view addSubView:btn];
[self.view setNeedsDsiplay];
}

Can someone please help?

  • 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-11T05:10:03+00:00Added an answer on June 11, 2026 at 5:10 am

    You are not instantiating the UIButton correctly. You should use buttonWithType: method.

    For example:

    - (void)viewDidLoad {
    
    [super viewDidLoad];
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    
    [btn setFrame:CGRectMake(10.0, 10.0, 50.0, 50.0)];
    
    [[self view] addSubview:btn];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to iOS programming and I need to implement a location aware application.
I'm new to iOS programming. I want to know how a database is created
I'm new to Xcode and programming for iOS, so I might not get what
I'm sure I'm dense from being new to iOS programming, but, I am having
I am new to iOS 5 programming so I'm sure that these are basic
I'm fairly new to iOS programming, but have a basic understanding of it. I
Im new to IOS programming but doing a bit for practice. I've created this
I am new to iOS programming, just to warn you! I'm using Xcode 4.2
i am new to iOS programming. I am building an application for a Course
I have a question. I am new to this ios programming. I am doing

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.