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

  • Home
  • SEARCH
  • 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 7999675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:34:18+00:00 2026-06-04T15:34:18+00:00

I’ve read a million posts on stackoverflow about nstimers, runloops and the main thread

  • 0

I’ve read a million posts on stackoverflow about nstimers, runloops and the main thread but they don’t seem to have the same problem or answer I’m looking for.
My situation:

  1. I’m trying to animate some stuff while there is some ‘loading going on’. The animation consists of a couple of scrollviews going back and forth using the contentOffset. I do this animation using an NSTimer.
  2. The ‘loading going on’ of point 1 is in fact not some simple loading, but some drawing on some other UIViews not currently visible to the user.

So to conclude, I’m trying to animate some scrollviews while drawing at the same time on UIViews. Is this even possible without them conflicting in such a way the the animation is not smooth? If I use a activityIndicatorView it’s definitely possible, the spinning wheel never stutters, it’s always spinning smoothly. I’ve tried to use runloops but I couldn’t figure it out.
Here’s some of my code so far:

-(void)startLoading
{
    [self performSelectorInBackground:@selector(showSpinningCells)];
    [self drawOnViews];
}

-(void)drawOnViews
{
    //HERE A LOT OF VIEWS ARE BEING UPDATED AND CALLED SETNEEDSDISPLAY
}

-(void)spinCells
{
    //HERE I USE PERFORMSELECTORONMAINTHREAD TO SET THE
    //CONTENTOFFSET OF THE SCROLLVIEWS
}

-(void)showSpinningCells
{    
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    spinLoop = [NSRunLoop currentRunLoop];
    spinTimer = nil;
    self.userInteractionEnabled = FALSE;
    spinTimer = [[NSTimer scheduledTimerWithTimeInterval:0.2 
                            target:self 
                          selector:@selector(spinCells) 
                          userInfo:nil 
                           repeats:YES] retain];    
    [spinLoop run]; 
    [pool release];
}

Please tell me if this is even possible before I try anything further and if so, how? Currently I never see any spinning. I do see spinning if I don’t do anything afterwards, but as soon as I call the drawing on the UIViews the spinning completely stops.

  • 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-04T15:34:20+00:00Added an answer on June 4, 2026 at 3:34 pm

    UI animation can only happen after your drawOnViews method exits, so that the UI run loop can get the time needed to do animation in the main thread. One solution is to chop up your drawOnViews method into really short asynchronous segments, each of which quickly exits so that a UI animation can continue in between each segment.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.