MBDevice Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | MBSingleton |
| Declared in | MBDevice.h |
Overview
The MBDevice singleton provides information about the device and operating
environment of the running application.
The MBDevice singleton is available by default as the Mockingbird variable
$Device.
Warning: You must not create instances of this class yourself; this class
is a singleton. Call the instance class method (declared by the
MBSingleton protocol) to acquire the singleton instance.
Device information
isSimulator
Returns YES when running in the iOS Simulator environment; NO when
running on the device.
@property (nonatomic, readonly) BOOL isSimulatorDeclared In
MBDevice.h
isIPhone
Returns YES when running in an iPhone environment.
@property (nonatomic, readonly) BOOL isIPhoneDeclared In
MBDevice.h
isIPad
Returns YES when running in an iPad environment.
@property (nonatomic, readonly) BOOL isIPadDeclared In
MBDevice.h
Operating system information
osType
Returns a human-readable string indicating the operating system type,
eg. “iPhone OS”.
@property (nonnull, nonatomic, readonly) NSString *osTypeDeclared In
MBDevice.h
osVersion
Returns the operating system version string, eg. “8.1.3”
@property (nonnull, nonatomic, readonly) NSString *osVersionDeclared In
MBDevice.h
osVersionComponents
Returns the individual components of the operating system version as an
array of NSNumbers, eg. [8, 1, 3].
@property (nonnull, nonatomic, readonly) NSArray *osVersionComponentsDeclared In
MBDevice.h
osVersionMajor
Returns the major component of the operating system version, eg. the 8
in “8.1.3”.
@property (nonnull, nonatomic, readonly) NSNumber *osVersionMajorDeclared In
MBDevice.h
osVersionMinor
Returns the minor component of the operating system version, eg. the 1
in “8.1.3”.
@property (nonnull, nonatomic, readonly) NSNumber *osVersionMinorDeclared In
MBDevice.h
osVersionRevision
Returns the revision component of the operating system version, eg. the 3
in “8.1.3”.
@property (nonnull, nonatomic, readonly) NSNumber *osVersionRevisionDeclared In
MBDevice.h
Application state information
appIsInBackground
Returns YES if the application is currently in the background.
@property (nonatomic, readonly) BOOL appIsInBackgroundDeclared In
MBDevice.h
currentOrientation
Returns the string “portrait” or “landscape” depending on the current
orientation of the device.
@property (nonnull, nonatomic, readonly) NSString *currentOrientationDeclared In
MBDevice.h
isPortrait
Returns YES if the device is currently in portrait orientation.
@property (nonatomic, readonly) BOOL isPortraitDeclared In
MBDevice.h
isLandscape
Returns YES if the device is currently in landscape orientation.
@property (nonatomic, readonly) BOOL isLandscapeDeclared In
MBDevice.h
Screen resolution information
screenScale
Returns the scale of the main UIScreen.
@property (nonnull, nonatomic, readonly) NSNumber *screenScaleDeclared In
MBDevice.h
isRetina
Returns YES if the main UIScreen’s scale is 2.0 or greater.
@property (nonatomic, readonly) BOOL isRetinaDeclared In
MBDevice.h
screenWidth
Returns the width of the main UIScreen in the current orientation.
@property (nonnull, nonatomic, readonly) NSNumber *screenWidthDeclared In
MBDevice.h
screenHeight
Returns the height of the main UIScreen in the current orientation.
@property (nonnull, nonatomic, readonly) NSNumber *screenHeightDeclared In
MBDevice.h
screenSize
Returns a comma-separated string containing the width and height of the
screen in the current orientation as “width,height”.
@property (nonnull, nonatomic, readonly) NSString *screenSizeDeclared In
MBDevice.h
screenSizePortrait
Returns a comma-separated string containing the width and height of the screen when the device is in portrait orientation.
@property (nonnull, nonatomic, readonly) NSString *screenSizePortraitDeclared In
MBDevice.h
screenSizeLandscape
Returns a comma-separated string containing the width and height of the screen when the device is in landscape orientation.
@property (nonnull, nonatomic, readonly) NSString *screenSizeLandscapeDeclared In
MBDevice.h