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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:52:55+00:00 2026-06-06T06:52:55+00:00

I am using a scrollview to display a viewcontrollers view. if the user reaches

  • 0

I am using a scrollview to display a viewcontrollers view. if the user reaches the end of the cached views my method reloads the new views. My NSLogs say that the method is finished but it takes additional 5 seconds to display the view.
I think that the [scrollView addSubview:vc.view] is very very slow but I found nothing to improve it.

the whole method gets called in -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView

 scrollView.userInteractionEnabled = NO;

    UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    [activityIndicator setFrame:CGRectMake((320.f*index)+135.f, 151, 50, 50)];
    [activityIndicator setHidesWhenStopped:YES];
    [activityIndicator startAnimating];

    [scrollView addSubview:activityIndicator];

    MBBAppDelegate *delegate = (MBBAppDelegate *)[UIApplication sharedApplication].delegate;

    [delegate fetchDealsWithFilter:dealFilter fromIndex:index toIndex:(index+3) onSuccess:^(id object){

        MBBDealList *list = object;

        int i = 0;

        ProductDetailViewController *vc;

        for (MBBDeal *deal in [list deals]) {

            NSLog(@"start %i",i);
            int indexInArray = i;//[list.deals indexOfObject:deal];

            if (indexInArray+index >= numDeals) {
                return;
            }

            vc = [[ProductDetailViewController alloc] init];

            //fetch the deal and insert
            vc.numberOfDeals = numDeals;
            vc.dealIndex = index+1+indexInArray;
            vc.dealFilter = dealFilter;
            vc.deal = deal;

            vc.view.frame = CGRectMake(320.f*(index+indexInArray), 0.f, 320.f, 436.f);

            [scrollView addSubview:vc.view];

            [productDetailViewControllers insertObject:vc atIndex:(index+indexInArray)];

            i++;
        }
        [activityIndicator stopAnimating];
        scrollView.userInteractionEnabled = YES;

    }];

}

Does anyone know how I can improve my method?

  • 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-06T06:52:56+00:00Added an answer on June 6, 2026 at 6:52 am

    What I can understand from your problem is that, the activity indicator that you have used to show the data fetch process is not used properly.
    You data fetch process is still working, even after the activity indicator disappears.

    You can do 2 things for that:
    ether call the data fetch method in background using performSelectorInBackground method or place the activity indicator in the app delegate where you have created your data fetch method.

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

Sidebar

Related Questions

I am using a ScrollView to hold and display a static map image, which
How can we create 2 table views in a single view without using section
I am using a scrollview to display various items in a horizontal fashion. How
I am using a scroll view to display a CATiledView of some large images.
I'm making the app-book for ipad like app-magazine. Now I'm using ScrollView and want
I am using a ScrollView which has multiple LinearLayout s and more LinearLayout s
I'm using the jquery Scrollview plugin ( http://code.google.com/p/jquery-scrollview/ ) to scroll drag a div
I have a UIScrollView which I create and size dynamically using... scrollView.contentSize = CGSizeMake(scrollView.frame.size.width
Im using a scroll view and need to make the view bigger so I
i have a scroll view with multiple images and i am using this code.

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.