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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:29:33+00:00 2026-05-15T10:29:33+00:00

I have a application, and had to create another .h and .m file. This

  • 0

I have a application, and had to create another .h and .m file. This is so my downloads will be down in the background

.h File

#import <UIKit/UIKit.h>


@interface AsynchronousImageView : UIImageView
{
    NSURLConnection *connection;
    NSMutableData *data;
}

- (void)loadImageFromURLString:(NSString *)theUrlString;

@end

And .m file

#import "AsynchronousImageView.h"
#import "DxxxAppDelegate.h"



@implementation AsynchronousImageView

- (void)loadImageFromURLString:(NSString *)theUrlString
{
    [self.image release], self.image = nil;
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:theUrlString]
                                             cachePolicy:NSURLRequestReturnCacheDataElseLoad
                                         timeoutInterval:30.0];

    connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}

- (void)connection:(NSURLConnection *)theConnection
    didReceiveData:(NSData *)incrementalData
{
    if (data == nil)
        data = [[NSMutableData alloc] initWithCapacity:2048];

    [data appendData:incrementalData];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)theConnection
{
    self.image = [UIImage imageWithData:data];
    [data release], data = nil;
    [connection release], connection = nil;
}

- (void)dealloc {
    [data release];
    [connection release];
    [super dealloc];
}

@end

Basicilly, i imported my .h file for my main xxx.appdelege so i could access a few of the Navigation COntrollers so i can push views.

Im basiclly trying to, download a picture, then once its completed display a view(loading view) when the download starts and remove view(loading screen) and push the main view with the UIImage.view is held.

I found these files online, they work but i cant find how i can do this. Any options?

Im trying to make it so, once it starts, i push a view using for loading, then i unload that screen and push the below

[navigationController pushViewController:vFullscreen animated:YES];

Can someone assist me? I went down this path because NSThread locked up because i tried to access UI things.

Thanks

  • 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-05-15T10:29:34+00:00Added an answer on May 15, 2026 at 10:29 am

    when you work with UI from background thread you should call [self performSelectorOnMainThread:@selector() withObject: waitUntilDone:]

    when you are trying to make something in background – you should split UI logic and background logic, to make calls on main thread rarely.

    for example

    in main thread:

    • open loading view controller
    • set callback target and selector for background downloader
    • start downloading with with background downloader class
    • wait for callback from background downloader
    • show next viewController

    in background thread (background downloader)

    • create thread
    • start downloading
    • when download finish – perform callback selector on main thread.

    this logic can be useful many times for any object that you will need to download.

    p.s. check apple source examples there is a many useful templates for common situations.

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

Sidebar

Related Questions

In my application i have two drop down boxes first box had origin second
I have had this problem w/ two seperate WYSWYG editors in my rails application
Ok, so I have an application that reads another processes memory. I initially had
I have an application that uses CoreData. I previously had a class named Marker
I had developed an application in which I have to display images from specific
In my experience I have only had 2 patterns work for large-scale desktop application
I have application with needs to have access to some sensitive data(in this case
at work we have an application that, at first, had been developed for a
I have an application (Legacy code) that contains interface Icomponent with save() methods and
I am trying to create a modular structure that will eventually live inside another

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.