获得IOS系统版本号
[[[UIDevice currentDevice] systemVersion] floatValue]
获得硬件名称
+ (NSString*)getMachine{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *name = malloc(size);
sysctlbyname("hw.machine", name, &size, NULL, 0);
NSString *machine = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
free(name);
if( [machine isEqualToString:@"i386"] || [machine isEqualToString:@"x86_64"] ) machine = @"ios_Simulator";
else if( [machine isEqualToString:@"iPhone1,1"] ) machine = @"iPhone_1G";
else if( [machine isEqualToString:@"iPhone1,2"] ) machine = @"iPhone_3G";
else if( [machine isEqualToString:@"iPhone2,1"] ) machine = @"iPhone_3GS";
else if( [machine isEqualToString:@"iPhone3,1"] ) machine = @"iPhone_4";
else if( [machine isEqualToString:@"iPod1,1"] ) machine = @"iPod_Touch_1G";
else if( [machine isEqualToString:@"iPod2,1"] ) machine = @"iPod_Touch_2G";
else if( [machine isEqualToString:@"iPod3,1"] ) machine = @"iPod_Touch_3G";
else if( [machine isEqualToString:@"iPod4,1"] ) machine = @"iPod_Touch_4G";
else if( [machine isEqualToString:@"iPad1,1"] ) machine = @"iPad_1";
else if( [machine isEqualToString:@"iPad2,1"] ) machine = @"iPad_2";
return machine;
}
㈡ ios swift怎么使用oc的宏
如果没c语言基础就直接搞swift吧,swift把oc中一些比较麻烦的东西进行了改进。比如字符串的赋值,oc中分引用赋值和显式,初学者很可能会乱用导致bug,swift里统一了,所有字符串赋值都是一个出来。
还有各种mutable和immutable的类,oc中采用在类名前面加个Mutable来区分,当初第一次用NSArray的时候硬是找不到Add方法,原来在NSMutableArray里。
Swift里用let和var两个关键字就把它们区分出来了,更自然,还少打字。然后Swift还支持范型,不需要像oc那样,从集合里挑个NSObject出来再强制转换。
㈢ IOS或者安卓系统的手机,什么软件可以运行EXCEL宏
2017年老版的可以的,就是找不到