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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:01:28+00:00 2026-06-15T09:01:28+00:00

I am developing an iOS 5.1 application on Xcode 4.2. I have a uitablcontroller

  • 0

I am developing an iOS 5.1 application on Xcode 4.2.
I have a uitablcontroller with different tabs. My problem is when a tab is clicked , the application ‘freezes’ for few seconds and does all the codes it’s meant to do, but it does not load the UIAlertView first as it should be.

I have the UIAlertView declared in the viewDidLoad.
Here is a code snippet:

- (void)viewDidLoad
{



NSLog(@"##### VIEW DID LOAD 1 #####");


// Display Alert: Loading

alertView = [[UIAlertView alloc] initWithTitle:@"Loading"
                                       message:@"\n"
                                      delegate:self
                             cancelButtonTitle:nil
                             otherButtonTitles:nil];

UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
spinner.center = CGPointMake(139.5, 75.5); // .5 so it doesn't blur
[alertView addSubview:spinner];
[spinner startAnimating];
[alertView show];

[super viewDidLoad];


NSLog(@"##### VIEW DID LOAD 2 #####");


self.tableView.dataSource = self;
self.tableView.delegate = self;

[self callMainMethod];

}

When the tab is clicked, I can see that the first NSLog’s are displayed in the Log, and then the main method is called, but the UIAlertview is not displayed.

  • 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-15T09:01:29+00:00Added an answer on June 15, 2026 at 9:01 am

    When viewDidLoad is running, it may be that the frame of the associated UIView has zero size. I don’t know, but the UIAlertView may be trying to present itself in this zero-size frame. Does it make sense if you present the UIAlertView in viewDidAppear?

    If [self callMainMethod] is taking lots of compute power, then the display might not be updated until it finishes. You could try moving it to viewDidAppear. You could also try delaying it, so that the main run loop for the UI thread, the thread that the display is updated on and the thread that executesviewDidLoad and all the other view... methods, has time to complete everything and become idle before you start the heavy processing. It’s only when the run loop has done all the processing it can that it starts actually to update the display. Like this:

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 200000000), dispatch_get_main_queue(), ^{
       [self callMainMethod];
    }
    

    The documentation for that is at http://developer.apple.com/library/ios/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html

    If that suspicion is correct, you should then get the UIAlertView popping straight up, only to have everything go dead for a while, while callMainMethod executes.

    I wish I knew how to write, “dispatch this block only after you’ve managed to finish updating the display with everything up to here”, but I don’t know how to do that. So the dispatch call above should delay the call to callMainMethod by 200ms, which is usually plenty.

    If that works, you should probably start another question, something like “How can I stop the display freezing while I execute this method.”

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

Sidebar

Related Questions

I'm developing an iOS 4 application with latest SDK and XCode 4.2. I have
I'm developing an iOS application with latest Xcode 4.5.2. I have the following folder
I'm developing an iOS 4 application using latest SDK and XCode 4.2. I have
I have developing an iPhone application using xcode 4 which is compatible with iOS
I'm developing an iOS 4 application with iOS 5.0 SDK and XCode 4.2. I
I'm developing an iOS 4 application with iOS 5.0 SDK and XCode 4.2. I
I'm developing an iOS 4 application with latest SDK and XCode 4.2. I'm using
I'm developing an iOS 4 application. I have this ViewController: @interface BlogViewController : UIViewController
I'm developing an iOS 4 application. I have a main view that contains another
I'm developing an iOs application with latest SDK and XCode 4.2. I need to

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.