The iOS framework that grows only as fast as its documentation
NISDKAvailability.m
1 //
2 // Copyright 2011-2014 NimbusKit
3 //
4 // Forked from Three20 June 10, 2011 - Copyright 2009-2011 Facebook
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
18 
19 #import "NimbusCore.h"
20 
21 #if !defined(__has_feature) || !__has_feature(objc_arc)
22 #error "Nimbus requires ARC support."
23 #endif
24 
25 #if __IPHONE_OS_VERSION_MAX_ALLOWED < NIIOS_6_0
26 const UIImageResizingMode UIImageResizingModeStretch = -1;
27 #endif
28 
29 BOOL NIIsPad(void) {
30  static NSInteger isPad = -1;
31  if (isPad < 0) {
32  isPad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? 1 : 0;
33  }
34  return isPad > 0;
35 }
36 
37 BOOL NIIsPhone(void) {
38  static NSInteger isPhone = -1;
39  if (isPhone < 0) {
40  isPhone = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) ? 1 : 0;
41  }
42  return isPhone > 0;
43 }
44 
46  static NSInteger isTintColorGloballySupported = -1;
47  if (isTintColorGloballySupported < 0) {
48  UIView* view = [[UIView alloc] init];
49  isTintColorGloballySupported = [view respondsToSelector:@selector(tintColor)];
50  }
51  return isTintColorGloballySupported > 0;
52 }
53 
54 BOOL NIDeviceOSVersionIsAtLeast(double versionNumber) {
55  return kCFCoreFoundationVersionNumber >= versionNumber;
56 }
57 
58 CGFloat NIScreenScale(void) {
59  return [[UIScreen mainScreen] scale];
60 }
61 
62 BOOL NIIsRetina(void) {
63  return NIScreenScale() == 2.f;
64 }
65 
67  return [UIPopoverController class];
68 }
69 
71  return [UITapGestureRecognizer class];
72 }
BOOL NIIsPhone(void)
Checks whether the device the app is currently running on is an iPhone/iPod touch or not...
BOOL NIIsTintColorGloballySupported(void)
Checks whether the device supports tint colors on all UIViews.
BOOL NIIsRetina(void)
Returns YES if the screen is a retina display, NO otherwise.
Class NIUIPopoverControllerClass(void)
This method is now deprecated.
BOOL NIDeviceOSVersionIsAtLeast(double versionNumber)
Checks whether the device's OS version is at least the given version number.
BOOL NIIsPad(void)
Checks whether the device the app is currently running on is an iPad or not.
Class NIUITapGestureRecognizerClass(void)
This method is now deprecated.
CGFloat NIScreenScale(void)
Fetch the screen's scale.