title: Access property of another class
body: <p>I have two classes. I'm trying to access a property from Class2 in Class1 (both subclasses of UIImageView). The x property is 0 when accessing it from Class1.</p>
  
  <p><strong>In Class2.h:</strong></p>
  
  <pre><code>@interface ...
  {
      int x;
  }
  
  @property (readwrite, nonatomic) int x;
  </code></pre>
  
  <p><strong>In Class2.m:</strong></p>
  
  <pre><code>@synthesize x;
  
  - (void)mainMethod
  {
      x = 4;
      [NSTimer scheduledTimerWithTimeInterval:0.02 
                                       target:self 
                                     selector:@selector(updateX) 
                                     userInfo:nil 
                                      repeats:YES]
  }
  
  - (void)updateX
  {
      x += 5;
  }
  </code></pre>
  
  <p><strong>In Class 1:</strong></p>
  
  <pre><code>- (void)mainMethod
  {
      Class2 obj = [[Class2 alloc] init];
      NSLog(@"%i", obj.x);
  }
  </code></pre>
  
  <p>Have I done something wrong in the code provided or is the problem caused by something else?</p>