title: Make the iPhone Screen Dim
body: <p>I have managed to ensure that the iPhone doesn't auto-lock using:</p>
  
  <pre><code>    [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ];
  </code></pre>
  
  <p>But how do I make the screen dim after a certain amount of time?</p>
  
  <p>Thanks...</p>
  
  <p>EDIT:</p>
  
  <p>Think I've found a solution myself:</p>
  
  <p>Use this method in your view controller to dim by adding a black view with 50% alpha. Make sure to set userInteractionEnabled = NO to pass events to underlying views.</p>
  
  <pre><code>- (IBAction)dim:(id)sender {
  UIView *dimView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
  dimView.backgroundColor = [UIColor blackColor];
  dimView.alpha = 0.5f;
  dimView.userInteractionEnabled = NO;
  [self.view addSubview:dimView];
  }
  </code></pre>
  
  <p>or, could risk it (but Apple may reject on submission):</p>
  
  <pre><code>[(id)[UIApplication sharedApplication] setBacklightLevel:1.0f];
  </code></pre>
  
  <p>That's a private API and shouldn't be used though...</p>