title: objective-c properties - getters and setters
body: <p>In a UIView subclass I have this property:</p>
  
  <pre><code>@property (nonatomic) CGFloat scale;
  
  #define DEFAULT_SCALE 0.90
  </code></pre>
  
  <p>and this getter and setter:</p>
  
  <pre><code>-(CGFloat)scale
  {
      if (!self.scale) {
          return DEFAULT_SCALE;
      }else{
          return self.scale;
      }
  }
  
  -(void)setScale:(CGFloat)scale
  {
      if (scale != self.scale) {
          self.scale = scale;
          [self setNeedsDisplay];
      }
  
  }
  </code></pre>
  
  <p>This isn't correct, because for example checking self.scale in the getter causes an infinite loop. What is the proper way to write the getter and setter so that I don't get infinite looping?</p>