解决NSTextField不水平居中的问题
在NSTableView中去掉右击菜单栏蓝色复选框
创建子类WipeMenuBorderTableView继承于NSTableView,重写方法
- (void)drawContextMenuHighlightForRow:(NSInteger)row {
// do nothing
}
获取udid
+(NSString* )GetHardwareUUID
{
NSString *ret = nil;
io_service_t platformExpert ;
platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")) ;
if (platformExpert) {
CFTypeRef serialNumberAsCFString ;
serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, CFSTR("IOPlatformUUID"), kCFAllocatorDefault, 0) ;
if (serialNumberAsCFString) {
ret = [(__bridge NSString *)(CFStringRef)serialNumberAsCFString copy];
CFRelease(serialNumberAsCFString); serialNumberAsCFString = NULL;
}
IOObjectRelease(platformExpert); platformExpert = 0;
}
return ret;
}
获取系统版本号
+(NSString *)systemVersion{
if (floor(kCFCoreFoundationVersionNumber) >0x1050) {
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
return [NSString stringWithFormat:@"%ld.%ld.%ld",version.majorVersion,version.minorVersion,version.patchVersion];
}
else
{
NSString *versionString;
NSDictionary * sv = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
versionString = [sv objectForKey:@"ProductVersion"];
return versionString;
}
}
获取系统序列号
+(NSString * )GetHardwareSerialNumber
{
NSString * ret = nil;
io_service_t platformExpert ;
platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")) ;
if (platformExpert) {
CFTypeRef uuidNumberAsCFString ;
uuidNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, CFSTR("IOPlatformSerialNumber"), kCFAllocatorDefault, 0) ;
if (uuidNumberAsCFString) {
ret = [(__bridge NSString *)(CFStringRef)uuidNumberAsCFString copy];
CFRelease(uuidNumberAsCFString); uuidNumberAsCFString = NULL;
}
IOObjectRelease(platformExpert); platformExpert = 0;
}
return ret;
}











网友评论