title: When to use brackets and when to use the period in Objective-C
body: <p>I'm a new iPhone/Objective-C developer and as I'm going through different tutorials and open source code, I am having a bit of a problem understanding when to use the square brackets "[ ]" and when to use the period " . " for accessing properties/methods of an object.</p>
  
  <p>For example, this code:</p>
  
  <pre><code>- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  
    [super setSelected:selected animated:animated];
  
    UIColor *backgroundColor = nil;
    if (selected){
      backgroundColor = [UIColor clearColor];
    } else {
      backgroundColor = [UIColor whiteColor];
    }
  
    self.todoTextLabel.backgroundColor = backgroundColor;
    self.todoTextLabel.highlighted = selected;
    self.todoTextLabel.opaque = !selected;
  
    self.todoPriorityLabel.backgroundColor = backgroundColor;
    self.todoPriorityLabel.highlighted = selected;
    self.todoPriorityLabel.opaque = !selected;
  }
  </code></pre>
  
  <p>Why does <code>[UIColor clearColor]</code> get brackets, but <code>todoTextLabel.backgroundColor</code> get the period?</p>
  
  <p>Could someone explain this easily for me?</p>