title: Associated objects inUIAlertView in iOS
body: <p>Associated objects are used for creating property in iOS and some cunning changes in iOS. Would anyone care to explain how is this doing any of these?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>- (IBAction)doSomething:(id)sender {
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"Alert" message:nil
                          delegate:self
                          cancelButtonTitle:@"OK"
                          otherButtonTitles:nil];
    objc_setAssociatedObject(alert, &amp;kRepresentedObject, 
                             sender,
                             OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    [alert show];
    
  }
  
  - (void)alertView:(UIAlertView *)alertView 
  clickedButtonAtIndex:(NSInteger)buttonIndex {
    UIButton *sender = objc_getAssociatedObject(alertView, 
                                                &amp;kRepresentedObject);
    self.buttonLabel.text = [[sender titleLabel] text];
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The apple's definition does not help me understand either. "Sets an associated value for a given object using a given key and association policy."</p>