title: How to measure position of UI objects on iPhone simulator screen
body: <p>I have calculated positions and offsets on paper. I have written code and debugged that I get expected results. However <strong>on iPhone Simulator things are overlapping</strong> by about 15 pixels.</p>
  
  <p>To go on with my debugging, I need to know where exactly UI objects are on the screen.</p>
  
  <p>Related to popup search keyboard and resizing a UITableView between static UISearchBar and dynamically added UITabBar (table view is embedded into one of the tabs). No, I really <strong>don't want to use any hardcoded values</strong> due rotation and different screen sizes.</p>
  
  <p>How can I find out this?</p>
  
  <pre><code>- (void)keyboardWasShown:(NSNotification*)aNotification
  {
  if (self.keyboardShown)
      return;
  
  // Get keyboard dimensions
  NSDictionary* info = [aNotification userInfo];
  NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
  CGSize kbSize = [aValue CGRectValue].size;
  NSValue* endValue = [info objectForKey:UIKeyboardCenterEndUserInfoKey];
  CGPoint endCenter = [endValue CGPointValue];
  
  CGRect frame = myView.frame;
  frame.size.height = endCenter.y - kbSize.height/2 - frame.origin.y;
  
  [UIView beginAnimations:nil context:nil];
  [UIView setAnimationDuration:0.2];
  
  myView.frame = frame;
  
  [UIView commitAnimations];
  
  self.keyboardShown = YES;
  }
  </code></pre>
  
  <p>...code just in case there're obvious bugs I can't see anymore...</p>