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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:28:17+00:00 2026-06-18T03:28:17+00:00

I have 2 main small image buttons say aBtn & bBtn . When i

  • 0

I have 2 main small image buttons say aBtn & bBtn. When i click aBtn / bBtn i Generate 6 image url as default checking the condition that the images are not nil. In the 6 images if some images are empty then i avoid that empty image alone & set the frame accordingly. When i click from aBtn to bBtn, i have the time delay. It is due to checking the 6 url images generate without nil/empty image each time & by setting the frame position accordingly.

This is the code i used to display the images & check the condition from the 6 url images data is not nil if something say 3rd url image is nil it will be avoided. How to overcome the delay to display the images?

    NSMutableString *strUrl;
    int i;
    int j=7;
    int k=0;
    xorigin=350;
    int cou=1;

    for( i=1;i<j;i++){

        strUrl=[[NSMutableString alloc]init];
        UIImageView *imageView= [[UIImageView alloc]init];


        [strUrl appendFormat:@"http://commondatastorage.googleapis.com/images2.solestruck.com/%@%@%@%@%@%@%@)-01060%d.jpg",
         [[[[shoeDetailDict objectForKey:@"vendorName"] lowercaseString] lowercaseString] stringByReplacingOccurrencesOfString:@" " withString:@"-"],@"-shoes/",[[shoeDetailDict objectForKey:@"vendorName"] stringByReplacingOccurrencesOfString:@" " withString:@"-"],@"-shoes-",[[shoeDetailDict objectForKey:@"productName"] stringByReplacingOccurrencesOfString:@" " withString:@"-"],@"-(",[[prdcolorimgArray objectAtIndex:tagedColor] stringByReplacingOccurrencesOfString:@" " withString:@"-"],i];

        NSURL *imageUrl=[[NSURL alloc]initWithString:strUrl];

        NSError *error;
        NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:strUrl] options:NSDataReadingUncached error:&error];
        NSLog(@"imageurl colors : %@",strUrl);

        if(i==4){

            imageView.frame =CGRectMake(25, 0, (self.view.frame.size.width*80)/100,(self.view.frame.size.height*40)/100);
            [imageView setImageWithURL:imageUrl];
        }

        else{

            if(data != nil ){
                cou++;
                imageView.frame =CGRectMake(xorigin, 0, (self.view.frame.size.width*80)/100,(self.view.frame.size.height*40)/100);
                [imageView setImageWithURL:imageUrl];
                xorigin=xorigin+320;

            }
        }
        imageView.backgroundColor=[UIColor whiteColor];
        [productScroll addSubview:imageView];
        productScroll.contentSize = CGSizeMake((self.view.frame.size.width)*cou, (self.view.frame.size.height*40)/100);
        productScroll.contentOffset=CGPointMake(0, 0);

        k++;
    }
  • 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-18T03:28:18+00:00Added an answer on June 18, 2026 at 3:28 am

    You are using dataWithContentsOfURL: that load information synchronously.

    Try to load all images first and than put them on the scroll view.

    Try to use this code:

    - (void) prepareImages {
        dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
            NSMutableArray * imagesArray = [NSMutableArray array];
            // Load all images here
            [self imagesLoaded:imagesArray]
        });
    }
    - (void) imagesLoaded:(NSArray*) images {
         dispatch_async(dispatch_get_main_queue(), ^{
            //Display images here
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small Java test app in Netbeans where the main() class reads
I have a small website sitting in a sub-domain of my main site. I'm
I have a very small program: public static void main(String[] args) { Queue<String> queue
I am working with jquery. I have a main image. When I place the
I have a small image processing application which does multiple things at once using
I have put together a script where the main image loads once clicked on
I have a button labeled Upload image, when you click the button it opens
I have main window which has inner grid components. When I press a button
I have main categories and sub categories. I want to be able to sort
I have main table called 'Employee' and another slave table called 'EmployeeTypes' that has

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.