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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:59:52+00:00 2026-05-27T12:59:52+00:00

I am working on displaying several Images in a scrollview loaded from a MapServer

  • 0

I am working on displaying several Images in a scrollview loaded from a MapServer which returns an image of showing a map.
So what I did is I have created 4 UIImageViews, put them in a NSMutableDictionary.
Then when scrolling to the desirable Image it will initiate to load the data from the url asynchronous.
so first I display an UIActivityIndicatorView, then it will load the data and at the end hide the UIActivityIndicatorView and display the UIImageView.

everything is working more or less fine, apart that it takes sooo long until the image displays, allthough the image is not that big and I have a log text indicating that the end of the function arrived… this log message appears immediately but the image still does not show…
If I call the URL by the Webbrowser the image is shown immediately as well.

below you see my piece of code.

- (void) loadSRGImage:(int) page {

UIImageView *currentSRGMap   = (UIImageView *)[srgMaps objectForKey:[NSString stringWithFormat:@"image_%i", page]];
UIActivityIndicatorView *currentLoading  = (UIActivityIndicatorView *)[srgMaps objectForKey:[NSString stringWithFormat:@"loading_%i", page]];


// if the image has been loaded already, do not load again
if ( currentSRGMap.image != nil ) return;

if ( page > 1 ) {

    MKCoordinateSpan currentSpan;
    currentSpan.latitudeDelta   = [[[srgMaps objectForKey:[NSString stringWithFormat:@"span_%i", page]] objectForKey:@"lat"] floatValue];
    currentSpan.longitudeDelta  = [[[srgMaps objectForKey:[NSString stringWithFormat:@"span_%i", page]] objectForKey:@"lon"] floatValue];

    region.span         = currentSpan;
    region.center       = mapV.region.center;
    [mapV setRegion:region animated:TRUE];
    //[mapV regionThatFits:region];
}
srgLegende.hidden = NO;

currentSRGMap.hidden = YES;
currentLoading.hidden = NO;
[currentLoading startAnimating];

NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] 
                                    initWithTarget:self
                                    selector:@selector(loadImage:) 
                                    object:[NSString stringWithFormat:@"%i", page]];

[queue addOperation:operation]; 
[operation release];

}

- (void) loadImage:(NSInvocationOperation *) operation {

NSString *imgStr = [@"image_" stringByAppendingString:(NSString *)operation];
NSString *loadStr = [@"loading_" stringByAppendingString:(NSString *)operation];

WGS84ToCH1903 *converter = [[WGS84ToCH1903 alloc] init];

CLLocationCoordinate2D coord1   = [mapV convertPoint:mapV.bounds.origin toCoordinateFromView:mapV];
CLLocationCoordinate2D coord2   = [mapV convertPoint:CGPointMake(mapV.bounds.size.width, mapV.bounds.size.height) toCoordinateFromView:mapV];
int x1 = [converter WGStoCHx:coord1.longitude withLat:coord1.latitude];
int y1 = [converter WGStoCHy:coord1.longitude withLat:coord1.latitude];
int x2 = [converter WGStoCHx:coord2.longitude withLat:coord2.latitude];
int y2 = [converter WGStoCHy:coord2.longitude withLat:coord2.latitude];

NSString *URL = [NSString stringWithFormat:@"http://map.ssatr.ch/mapserv?mode=map&map=import/dab/maps/dab_online.map&mapext=%i+%i+%i+%i&mapsize=320+372&layers=DAB_Radio_Top_Two", y1, x1, y2, x2];

NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:URL]];
UIImage* image = [[UIImage alloc] initWithData:imageData];
[imageData release];

UIImageView *currentSRGMap   = (UIImageView *)[srgMaps objectForKey:imgStr];
UIActivityIndicatorView *currentLoading  = (UIActivityIndicatorView *)[srgMaps objectForKey:loadStr];

currentSRGMap.hidden = NO;
currentLoading.hidden = YES;
[currentLoading stopAnimating];

[currentSRGMap setImage:image]; //UIImageView
[image release];

NSLog(@"finished loading image: %@", URL);

}

  • 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-27T12:59:53+00:00Added an answer on May 27, 2026 at 12:59 pm

    I had a similar thing in my app, and i used the SDWebImage from https://github.com/rs/SDWebImage. This has a category written over UIImageView. You need to mention a placeholder image and a url to the UIImageView. It will display the image once it is downloaded and also maintains a cache of the downloaded images, hence avoiding multiple server calls.

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

Sidebar

Related Questions

The application I am working on have several database fields called active, which is
I have my map working and displaying correctly. I trying to get it to
I am working on a Website which is displaying all the apps from the
I am working with a iPhone application in which I am displaying images in
i am working on displaying an image and placing an icon on top of
Recently I was working on displaying workflow diagram images in our web application. I
I currently have a working gridview displaying some thumbnails. Currently, when you select an
I'm displaying entries from SQLite database in Expandable ListView and everything is working correctly
I am working on a project, whereby I have several groups, several permissions and
I'm working on an app that involves displaying comments from a website. These comments

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.