[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changeFrames:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
-(void)changeFrames:(NSNotification *)notification{
NSLog(@"change notification: %@", notification.userInfo);
float width=[[UIScreen mainScreen]bounds].size.width*[[UIScreen mainScreen] scale];
float height=[[UIScreen mainScreen]bounds].size.height*[[UIScreen mainScreen] scale];
if ([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait
|| [[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@">>>portrait");
self.frame=CGRectMake(0, 0, height, width);
}else{
NSLog(@">>>landscape");
self.frame=CGRectMake(0, 0, width, height);
}
NSLog(@"view—> %@",self);
}
//得到当前屏幕的尺寸: CGSize size_screen = [[UIScreenmainScreen]bounds].size; //获得缩放率: CGFloat scale_screen = [UIScreen mainScreen].scale; 此时屏幕尺寸的宽高与scale的乘积就是相应的分辨率值。 CGRect sizeOfA4 = CGRectMake(0, 0, 595, 842);//生成PDF文件时按A4标准 CGRect sizeOfA5 = CGRectMake(0, 0, 421, 595);//生成PDF文件时按A5标准
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
NSLog(@" on simulator");
#else
NSLog(@"not on simulator");
#endif
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//设备为ipad
} else {
//设备为iphone 或 ipod
}
NSString *deviceType = [UIDevice currentDevice].model;
if([deviceType isEqualToString:@"iPhone"]) {
//iPhone
}else if([deviceType isEqualToString:@"iPod touch"]) {
//iPod Touch
}else {
//iPad
}
//软件信息
NSLog(@"sysname=%@",[[UIDevice currentDevice] systemName]);// 系统名
NSLog(@"systemVersion=%@",[[UIDevice currentDevice] systemVersion]); //版本号
NSLog(@"model=%@",[[UIDevice currentDevice] model]); //类型(ipad、ipod、iphone)而[[UIDevice currentDevice] userInterfaceIdiom]只能判断iphone和ipad
NSLog(@"olduuid=%@",[[UIDevice currentDevice] uniqueIdentifier]); //唯一识别码 ios5.0开始deprecated
NSLog(@"name=%@",[[UIDevice currentDevice] name]); //设备名称
NSLog(@"localizedModel=%@",[[UIDevice currentDevice] localizedModel]); // 本地模式
NSLog(@"ios6UUID=%@",[[[UIDevice currentDevice] identifierForVendor] UUIDString]);//ios6.0开始available
----------注:以下内容未测试---------------
// 硬件信息
[UIDevice platform];//平台
[UIDevice cpuFrequency]];//cpu信息
UIDevice busFrequency]];//总线
[UIDevice totalMemory]];//总内存
UIDevice userMemory]];//已经使用的内存
-----------------------------------------------------------------------------------------------------------------------------
//App信息
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
CFShow(infoDictionary);//所有plist内容
// app名称
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
// app版本
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
// app build版本
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
//判断是否有照相机
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
NSLog(@"有");
else
NSLog(@"没有");
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有