An important difference between frame and bounds
If you're like me, you generally assume that a `UIView`'s frame and bounds properties have the same size but different origins. This is not necessarily the case for a subview of a `UIWindow` (typically your application's key window's root view controller's view) if your application supports both portrait and landscape orientations. Why not? A view's bounds [describes the view’s location and size in its own coordinate system](http://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW1) while its frame [describes the view’s location and size in its superview’s coordinate system](http://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW5). Thus, the root view controller's view's frame is in the window's coordinate system. A noteworthy characteristic of `UIWindow` is that its coordinate system is always in portrait orientation. As such, the root view controller's view's frame will not properly respect interface orientation changes, but its bounds will. **Therefore, you should always perform layout calculations using your view controller's view's bounds size, as opposed to its frame size.** For this same reason, [extra care must be taken when determining the keyboard's height](http://developer.apple.com/library/ios/documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/doc/uid/TP40006817-CH3-SW27): - (void)keyboardWillShow:(NSNotification *)notification { CGRect keyboardFrame = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; float keyboardHeight = UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ? keyboardFrame.size.height : keyboardFrame.size.width; }














