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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:12:45+00:00 2026-05-22T12:12:45+00:00

Here is a piece of code that I’m having problems with: -(IBAction) nextRegister {

  • 0

Here is a piece of code that I’m having problems with:

-(IBAction) nextRegister {
    [DSBezelActivityView newActivityViewForView:self.view.superview];
    previousPosition = (NSInteger *) currentPosition;
    currentPosition = (NSInteger *) ((int)currentPosition + (int) 1 );    
    [currentRegistry updateOnServer];
    [self loadNewRegisterInfos];
    [DSBezelActivityView removeViewAnimated:YES];
}

Line by line, here is what this snippet does (or should do):

Show a DSBezelActivityView (from this: http://www.dejal.com/developer/dsactivityview)

Previous position receives actual position (since this will move to the next)

Next is current + 1;

Updates record in server (this takes ~1s)

Loads new record and renders on screen (this takes 1~3s, tops)

This line removes the DSBezelActivityView.

So, when I tap the button to load next record, it is supposed to show the ActivityView, load the data, then update the screen and release the ActivityView.
But what happens is: It freezes the app for 3s, shows and dismisses the activity view in less than a second and then finishes the routine.
What is wrong?


[Edited]
Resolved! Its a thread issue.
Split among 4 methods:

-(IBAction) nextRegister {
    [NSThread detachNewThreadSelector:@selector(openActivityView) toTarget:self     withObject:nil];
    [self viewNextRegister];
    [self removeView];
}

-(void)viewNextRegister{
    previousPosition = (NSInteger *) currentPosition;
    currentPosition = (NSInteger *) ((int)currentPosition + (int) 1 );
    [currentRegister setScoreOnServer];
    //    [NSThread detachNewThreadSelector:@selector(loadRegisterInfo) toTarget:self withObject:nil];
    [self loadRegisterInfo];
}

-(void)openActivityView{
    [DSBezelActivityView newActivityViewForView:self.view.superview];
}

-(void)removeView {
    [DSBezelActivityView removeViewAnimated:YES];    
}
  • 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-22T12:12:45+00:00Added an answer on May 22, 2026 at 12:12 pm

    Rather than a separate thread which can cause issues if you aren’t careful you can also do:

    -(void) doNextRegister {
        previousPosition = (NSInteger *) currentPosition;
        currentPosition = (NSInteger *) ((int)currentPosition + (int) 1 );    
        [currentRegistry updateOnServer];
        [self loadNewRegisterInfos];
        [DSBezelActivityView removeViewAnimated:YES];
    }
    
    -(IBAction) nextRegister {
        [DSBezelActivityView newActivityViewForView:self.view.superview];
        [self performSelector:@selector(doNextRegister) withObject:nil afterDelay:0.0];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a piece of code that I've written. The problem that I'm having
Here is the piece of code that I have used for Java 5.0 TreeSet<Integer>
Here's a piece of code that takes most time in my program, according to
Here is an interesting piece of code that my fellow team members were just
I have a piece of code here that i really could use some help
I have a piece of code here that does not work despite me using
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
I have here a piece of code that record the number of bottles collected
Here's a piece of code that I've written to check if the sum of
Here's an interesting architectural query. I have a piece of code that needs to

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.