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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:36:29+00:00 2026-06-07T04:36:29+00:00

I am new to iPhone Development. Please Help me I have a view controller

  • 0

I am new to iPhone Development. Please Help me

I have a view controller calling method from NSObject class in the background for view controller when the method calls in that i am creating a view i wrote their self.view addSubview:view after this line my view did load calls again.

I dont know why this problem appears please help me here is my code.

NSObject.m

- (void) showModalMessage:(NSString *)mes
{
  self = [super init];
        if (self) {
            objViewController = [[ViewController alloc] init];
        }
    [objViewController showPopUp:mes];
}

ViewController.m
- (void) showPopUp:(NSString *)mes
{

    labelView = [[UIView alloc] initWithFrame:CGRectMake(470, 740, 380, 50)];
    [self setLabelViewSettings];
    label = [[UILabel alloc] initWithFrame:CGRectMake(20, 8, 340, 30)];
    [self setLabelSettings];
    [labelView addSubview:label];
    [label release];
    [self.view addSubview:labelView];// After This line View did load calls again 
    [labelView release];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.6];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(hide)];
    [UIView commitAnimations];
}

Sorry For my bad english please help me

  • 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-07T04:36:32+00:00Added an answer on June 7, 2026 at 4:36 am

    Subclasses of UIViewController automatically call viewDidLoad whenever the view controller loads its view into memory. View controllers load their views only when needed. So in [self.view addSubview:labelView] the self.view is causing the view to be loaded into memory and viewDidLoad to be called. Immediately before this line the view property must have been nil and accessing the view property with self.view automatically loads the view into memory as described in the UIViewController Class Reference.

    Note that viewDidLoad can be called multiple times because view controllers may unload their views and set their view property to nil in low memory situations. You need to make sure viewDidLoad is safe to call multiple times.

    As jrturton pointed out you are setting self to a new object in showModalMessage:, which is wrong. This guarantees that when you get to showPopUp: your newly created ViewController object will not have loaded its view yet so you will always call viewDidLoad when you hit self.view.

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

Sidebar

Related Questions

I am new to iPhone development. I have created one view controller and I
I am new to iphone development.I have created a view based application.Now i want
I am very new to iPhone/iPad development. can you please help me create this
I am new to iphone development.I have created a button in UIView controller.On clicking
hi guys i am new to iphone apps development please help me to show
Im new to iPhone game development, can you please explain about the GLKMatrix4 in
Im new to iPhone development and I have really taken this to me. I
I am very new to iPhone development. I downloaded the iPhoneHTTPServer application from bellow
I'm new to iPhone development. I'm working on a table view (default UITableView subclass)
I am new to iphone development.I have created map applications and displayed the cuurent

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.