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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:43:02+00:00 2026-06-03T05:43:02+00:00

I got two properties initialized in header file: @property (readwrite, assign) int Figure1; @property

  • 0

I got two properties initialized in header file:

@property (readwrite, assign) int Figure1;
@property (readwrite, assign) int State;

and in .m

@synthesize Figure1;
@synthesize State;

Then I got

UISwipeGestureRecognizer *swipeLeft = 
    [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftMade:)] autorelease];
    [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
    [self addGestureRecognizer:swipeLeft];

and

UITapGestureRecognizer *oneFingerTwoTaps = 
    [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ooneFingerTwoTaps)] autorelease];
    [oneFingerTwoTaps setNumberOfTapsRequired:2];
    [oneFingerTwoTaps setNumberOfTouchesRequired:1];
    [self addGestureRecognizer:oneFingerTwoTaps];

initialized in the class.

The methods called:

- (void)ooneFingerTwoTaps
{
    [NSThread detachNewThreadSelector:@selector(oneFingerTwoTaps) toTarget:self withObject:nil];
}

- (void)swipeLeftMade:(UISwipeGestureRecognizer *)recognizer
{
    [NSThread detachNewThreadSelector:@selector(moveLeftSwipe) toTarget:self withObject:nil];
}

In the first thread there is the main program:

- (void)oneFingerTwoTaps
{
    PlayScene *tView = [[PlayScene alloc]initWithFrame:CGRectMake(0, 0, 320, 420)];
    [self addSubview:tView];
    while (GameState==GamePlaying) {
        Figure1 = 1; State = 1;
        [self moveFig];
    }
}

In the second thread I need to use the values of properties that are changed on the first thread

-(void)moveLeftSwipe  {
int fset = State, figure=Figure1;
//some other stuff
}

But the problem is that the value of properties isn’t shared between threads, I was told that “nonatomic” might cause such problem, but I didn’t use it. May be I am declaring something wrong?

  • 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-03T05:43:04+00:00Added an answer on June 3, 2026 at 5:43 am

    Just used static variables instead of properties. Static variables are shared between threads.

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

Sidebar

Related Questions

I've got a properties file with two distinct key-value pair patters like the following;
I got a list of RegionGroup objects with two properties: an int number and
I've got a class representing an interval. This class has two properties start and
I got two tables Product(Productname VARCHAR(10), Rating REAL) and Review(RatingID INT, Productname VARCHAR(10), Rating
I tried to implement IEnumerator< Status > but got errors about two different Properties
I've got a simple object post that has two NSMutableArrays as properties. One is
I've got a class with two properties: @interface Contact : NSObject { NSString *lastname;
I've got two UITextFields firstname and email . I've got those as retained properties
I've got a bindable model class (lets call it myModel) with two properties, label
I've got two Silverlight Controls in my project, both have properties TeamId. I would

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.