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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:59:17+00:00 2026-06-02T13:59:17+00:00

I have UIWebView which has loaded an image from the internet. I have a

  • 0

I have UIWebView which has loaded an image from the internet. I have a button which opens a UIActionSheet to give you the option to tweet this picture in the UIWebView. If you hit Tweet in the UIActionSheet it disappears and you see the UIWebview again. In the background the image is loading from the internet to attach it to the tweet. This may take several time depending of the imagesize.
I want to display now an information for the user that he knows what is going. I want to display a MBProgressHUD while the user is waiting that the Twitterconsole appears.
I try to start the HUD when the button is press and the UIActionSheet disappears but it didn’t came up. It comes up in background when the Twitterconsole appears. This a little to late.
So what in the best place to start/stop the HUD?
Thanks

- (void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{


if (buttonIndex == 0)
{
    [self hudTweet];
    [self tweet];
       }

- (void) tweet {

if ([TWTweetComposeViewController canSendTweet])
{
    TWTweetComposeViewController *tweetSheet = 
    [[TWTweetComposeViewController alloc] init];
    [tweetSheet setInitialText:
     @"Tweeting from "];

    NSString *fullURL = beverageViewString; 
    NSURL *url = [NSURL URLWithString:fullURL];


    NSString *paths = NSTemporaryDirectory();
    NSError *error;

    if (![[NSFileManager defaultManager] fileExistsAtPath:paths])
        [[NSFileManager defaultManager] createDirectoryAtPath:paths withIntermediateDirectories:NO attributes:nil error:&error];

    NSString *filePath = [paths stringByAppendingPathComponent:[self.title stringByAppendingFormat:@".jpeg"]];
    NSData *jpegFile = [NSData dataWithContentsOfURL:url];
    [jpegFile writeToFile:filePath atomically:YES];

    [tweetSheet addImage:[UIImage imageWithContentsOfFile:filePath]];


    [self presentModalViewController:tweetSheet animated:YES];


}
else
{
    UIAlertView *alertView = [[UIAlertView alloc] 
                              initWithTitle:@"Sorry"                                                             
                              message:@"You can't send a tweet right now because your account isn't configured"
                              delegate:self                                              
                              cancelButtonTitle:@"OK"                                                   
                              otherButtonTitles:nil];
    [alertView show];
}

- (void) hudTweet {


HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];

[self.view.window addSubview:HUD];



HUD.delegate = self;

HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Loading";
HUD.detailsLabelText = @"updating data";

}

  • 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-02T13:59:19+00:00Added an answer on June 2, 2026 at 1:59 pm

    You are downloading your image in the main thread synchronously and thereby preventing the UI from updating. See this answer for a detailed explanation and possible workarounds.

    The best option for you though, is to download the image asynchronously using something like NSURLRequest (see the showURL: example and according delegate callbacks).

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

Sidebar

Related Questions

I have a UIWebView in which it has a UITapGestureRecognizer and basically in my
I have a UIWebView with content populated from a Last.fm API call. This content
I have a UIWebView in my application which has links inside that when clicked
So I have a UIView which has a UIWebView and I want so that
I have a UISplitViewController which has a UIWebView assigned to its detailedView. The problem
I have an iPad UIWebView which has to display some rtfd.zip files. I try
I have a UITextView which has a UIWebView just below it. The frame of
I have a UIViewController which is a UIWebViewDelegate and has a UIWebView inside of
I have a split view controller in which the detail view has a button
I have a UIWebView which is loading a webpage. The webpage has a div-element

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.