有些时候,我们需要将代码简洁化,这样便于读代码。我们可以将一些不变的东东抽取出来,将变化的东西作为参数。定义为宏,这样在写的时候就简单多了。下面例举了一些常用的宏定义和大家分享:1. 判断设备的操作系统是不是ios71.#define IOS7 ( [[[UIDevice currentDevice...
分类:
移动开发 时间:
2015-05-27 09:46:54
阅读次数:
143
一、设备旋转(上苹果商店有风险)*这种方法当在General中勾选了Device Orieation 的Protrait后再用下面代码不能设置屏幕旋转至横屏。if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientati...
分类:
其他好文 时间:
2015-05-23 15:31:21
阅读次数:
119
@interface UIDevice (Helper) - (BOOL)isJailbroken; @end@implementation UIDevice (Helper) - (BOOL)isJailbroken { BOOL jailbroken = NO; NSString *cydiaP...
分类:
移动开发 时间:
2015-05-22 18:59:59
阅读次数:
126
CGSize textSize = CGSizeZero; if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) { textSize = [text sizeWithAttributes: @{NSFontAt...
分类:
其他好文 时间:
2015-05-22 13:23:50
阅读次数:
118
1、iPhone 系统版本
1. UIDevice
@interface UIDevice : NSObject
+ (UIDevice *)currentDevice;
@property(nonatomic,readonly,retain) NSString *name; // 设备名称
@property(nonatomic,readonly,r...
分类:
移动开发 时间:
2015-05-20 18:29:49
阅读次数:
155
在次之前,补充个内容。UIDevice是无法获得具体的设备型号的。 要获得设备型号,比如(iphone 4s, iphone5)这样的,要通过这样的办法。 1.引入头文件。 #include?<sys/types.h> #include?<sys/sysctl.h> 2.获取...
分类:
移动开发 时间:
2015-05-13 01:01:20
阅读次数:
233
1、获取设备的信息
[objc] view
plaincopy
UIDevice *device = [[UIDevice alloc] int];
NSString *name = device.name; //获取设备所有者的名称
NSString *model = device.name; //获取设备的类别 ...
分类:
移动开发 时间:
2015-05-11 16:08:57
阅读次数:
230
iOS的APP的应用开发的过程中,有时为了bug跟踪或者获取用反馈的需要自动收集用户设备、系统信息、应用信息等等,这些信息方便开发者诊断问题,当然这些信息是用户的非隐私信息,是通过开发api可以获取到的。那么通过那些api可以获取这些信息呢,iOS的SDK中提供了UIDevice,NSBundle,...
分类:
移动开发 时间:
2015-05-10 12:53:12
阅读次数:
149
NSString* identifierNumber = [[UIDevice currentDevice].identifierForVendor UUIDString] ;
NSLog(@"手机序列号: %@",identifierNumber);
//手机别名: 用户定义的名称
NSString* userPhoneName = [[UIDevice curre...
分类:
移动开发 时间:
2015-05-08 22:10:43
阅读次数:
178
ios默认viewController的View会延伸到最顶端,即使上面有导航条、状态栏,可以设置edgesForExtendedLayout属性 f([[[UIDevice?currentDevice]?systemVersion]?floatValue]?>=?7.0){
????????
???...
分类:
其他好文 时间:
2015-05-07 12:46:21
阅读次数:
102