title: How to highlight a UIView like Apple does
body: <p>When the user touches a UIButton it gets grayed-out a bit. What apple does to get such an effect? I need the same effect on my custom UIButton when it is highlighted.</p>
  
  <pre><code>-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
      AppDelegate* appDelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
      if ([keyPath isEqualToString:@"highlighted"]){
          UIButton *button = object;
          if (button.isHighlighted) {
              self.backgroundColor=[UIColor colorWithRed:36.0/255.0 green:153.0/255.0 blue:116.0/255.0 alpha:1];
          }else{
              self.backgroundColor=appDelegate.currentAppColor;
          }
      }
  }
  </code></pre>
  
  <p>Im using this code, but changing background color wont affect any subviews. I need them to be grayed out too.</p>