标签:
iOS的版本号,一个叫做Version,一个叫做Build,这两个值都可以在Xcode 中选中target,点击“Summary”后看到。 Version在plist文件中的key是“CFBundleShortVersionString”,和AppStore上的版本号保持一致,Build在plist中的key是“CFBundleVersion”,代表build的版本号,该值每次build之后都应该增加1。这两个值都可以在程序中通过下面的代码获得:
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; CFShow(infoDictionary); // app名称 NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"]; // app版本 NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; // app build版本 NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
获取屏幕尺寸和分辨率
// 获取屏幕尺寸 CGRect rect = [[UIScreen mainScreen] bounds]; CGSize size = rect.size; CGFloat width = size.width; CGFloat height = size.height; // 获取分辨率 CGFloat scale_screen = [UIScreen mainScreen].scale; width = width*scale_screen, height = height*scale_screen // 打印得到像素 NSLog(@"print %f,%f",width,height);
标签:
原文地址:http://www.cnblogs.com/pinecoder/p/5045055.html