Click here to support Nimbus development and make a donation at www.pledgie.com !
An iOS framework whose growth is bounded by O(documentation).
Common Metrics

Overview

For common system metrics.

If you ever need to work with system metrics in any way it can be a pain in the ass to try to figure out what the exact metrics are. Figuring out how long it takes the status bar to animate is not something you should be spending your time on. The metrics in this file are provided as a means of unifying a number of system metrics for use in your applications.

What Qualifies as a Common Metric

Common metrics are related to system components, such as the dimensions of a toolbar in a particular orientation or the duration of a standard animation. This is not the place to put feature-specific metrics, such as the height of a photo scrubber view.

Examples

Positioning a Toolbar

The following example updates the position and height of a toolbar when the device orientation is changing. This ensures that, in landscape mode on the iPhone, the toolbar is slightly shorter to accomodate the smaller height of the screen.

 - (void)willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation
                                          duration: (NSTimeInterval)duration {
   [super willAnimateRotationToInterfaceOrientation: toInterfaceOrientation
                                           duration: duration];
 
   CGRect toolbarFrame = self.toolbar.frame;
   toolbarFrame.size.height = NIToolbarHeightForOrientation(toInterfaceOrientation);
   toolbarFrame.origin.y = self.view.bounds.size.height - toolbarFrame.size.height;
   self.toolbar.frame = toolbarFrame;
 }

Functions

CGFloat NIToolbarHeightForOrientation (UIInterfaceOrientation orientation)
UIViewAnimationCurve NIStatusBarAnimationCurve (void)
NSTimeInterval NIStatusBarAnimationDuration (void)
UIViewAnimationCurve NIStatusBarBoundsChangeAnimationCurve (void)
NSTimeInterval NIStatusBarBoundsChangeAnimationDuration (void)
CGFloat NIStatusBarHeight (void)
NSTimeInterval NIDeviceRotationDuration (BOOL isFlippingUpsideDown)
UIEdgeInsets NICellContentPadding (void)

Function Documentation

CGFloat NIToolbarHeightForOrientation ( UIInterfaceOrientation  orientation)

Fetch the height of a toolbar in a given orientation.

On the iPhone:

  • Portrait: 44
  • Landscape: 33

On the iPad: always 44

Definition at line 23 of file NICommonMetrics.m.

UIViewAnimationCurve NIStatusBarAnimationCurve ( void  )

The animation curve used when changing the status bar's visibility.

This is the curve of the animation used by -[[UIApplication sharedApplication] setStatusBarHidden:withAnimation:].

Value: UIViewAnimationCurveEaseIn

Definition at line 33 of file NICommonMetrics.m.

NSTimeInterval NIStatusBarAnimationDuration ( void  )

The animation duration used when changing the status bar's visibility.

This is the duration of the animation used by -[[UIApplication sharedApplication] setStatusBarHidden:withAnimation:].

Value: 0.3 seconds

Definition at line 39 of file NICommonMetrics.m.

UIViewAnimationCurve NIStatusBarBoundsChangeAnimationCurve ( void  )

The animation curve used when the status bar's bounds change (when a call is received, for example).

Value: UIViewAnimationCurveEaseInOut

Definition at line 45 of file NICommonMetrics.m.

NSTimeInterval NIStatusBarBoundsChangeAnimationDuration ( void  )

The animation duration used when the status bar's bounds change (when a call is received, for example).

Value: 0.35 seconds

Definition at line 51 of file NICommonMetrics.m.

CGFloat NIStatusBarHeight ( void  )

Get the status bar's current height.

If the status bar is hidden this will return 0.

This is generally 20 when the status bar is its normal height.

Definition at line 57 of file NICommonMetrics.m.

NSTimeInterval NIDeviceRotationDuration ( BOOL  isFlippingUpsideDown)

The animation duration when the device is rotating to a new orientation.

Value: 0.4 seconds if the device is being rotated 90 degrees. 0.8 seconds if the device is being rotated 180 degrees.

Parameters:
isFlippingUpsideDownYES if the device is being flipped upside down.

Definition at line 69 of file NICommonMetrics.m.

UIEdgeInsets NICellContentPadding ( void  )

The padding around a standard cell in a table view.

Value: 10 pixels on all sides.

Definition at line 75 of file NICommonMetrics.m.

Generated for Nimbus by doxygen 1.7.4-20110629