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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:00:32+00:00 2026-06-12T03:00:32+00:00

I want to display an alert view on pressing a button. It is displayed

  • 0

I want to display an alert view on pressing a button. It is displayed but it takes too much time to be displayed on screen. here is the function that I am calling on pressing the button:

-(void)saveAndClose:(id)sender
{
    waitForOCR=[[UIAlertView alloc] initWithTitle:@"Processing..." message:@"Please wait." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil, nil];
    waitForOCR.delegate=self;
    [waitForOCR show];
    if(!isCancelled){
    NSMutableArray *dateSaved=[[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"dateCaptured"]];
    NSDateFormatter *dateText=[[NSDateFormatter alloc] init];
    [dateText setDateFormat:@"yyyy-MM-dd"];
    NSDate *now=[NSDate date];
    NSString *dateValue=[dateText stringFromDate:now];
    [dateSaved addObject:dateValue];
    NSMutableArray *timeSaved=[[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"timeCaptured"]];
    NSDateFormatter *timeText=[[NSDateFormatter alloc] init];
    [timeText setDateFormat:@"HH:mm:ss"];
    NSString *timeValue=[timeText stringFromDate:now];
    [timeSaved addObject:timeValue];
    [[NSUserDefaults standardUserDefaults] setObject:dateSaved forKey:@"dateCaptured"];
    [[NSUserDefaults standardUserDefaults] setObject:timeSaved forKey:@"timeCaptured"];
    [dateSaved release];
    dateSaved=nil;
    [timeSaved release];
    timeSaved=nil;
    int counter = [[NSUserDefaults standardUserDefaults] integerForKey:@"LaunchesCounter"];
    counter++;
    [[NSUserDefaults standardUserDefaults] setInteger:counter forKey:@"LaunchesCounter"];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"image%d.png",counter]];
    NSData *thedata = [[NSData alloc] initWithData:UIImagePNGRepresentation(imageToCrop)];
    [thedata writeToFile:localFilePath atomically:YES];
    [thedata release];

    [NSThread detachNewThreadSelector:@selector(processOcrAt:) toTarget:self withObject:[self.imageCropper getCroppedImage]];
    }
    else{
        isCancelled=FALSE;
    }

}

As you can see that I am displaying UIAlerView at the start of the function. But it is taking too long to be displayed.
Any suggestion to fix this issue?
Thanks
Regards
Idrees

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

    The alert will only show up at the end of the current run loop, so everything you do right after “showing” it, will actually happen before. Note that it would be a good idea to move that code into the background anyway, as it will otherwise block the main thread and make the app unresponsive at best.

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

Sidebar

Related Questions

I want to display an alert box multiple times with a button click event
I want to display error message or alert message after checking the condition. here
i want to display the table view in alert view. This table view contains
I want to display the alert dialog box to device screen size. I got
I want to display script errors in a popup alert instead of showing them
I want to display a form in a Div, in alert box. How would
I want display data from database in Listbox...Here is my code, It is not
I want to avoid script alert in my view page.That is when i users
How do I display ajax response on particular div? This statement worked alert(data[i]['title']); but
I want to show UIView in UIAlert and alert should be display in all

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.