美文网首页
iOS7兼容

iOS7兼容

作者: Ywaiting | 来源:发表于2016-11-09 19:40 被阅读0次

1、[UIFontsystemFontOfSize:15weight:3]此方法是8.2后出的,在8.2以前系统无法响应,楼主是在登录界面里面用了这个方法,导致整个登录界面无法调出,注意8.2以前的此方法无效,iOS 7可以使用 IOS_VERSION < 8 ? [UIFont systemFontOfSize:15] : [UIFont systemFontOfSize:15 weight:3][UIFontsystemFontOfSize:15]

2、 imageFromBundle

在iOS8下,下面这段代码是没有问题的。

+ (UIImage *)imagesNamed:(NSString *)name fromBundle:(NSString *)bundleName

{

NSString *main_images_dir_path = [[[NSBundle mainBundle] resourcePath] stringByAppendingFormat:@"/%@.bundle",bundleName];

NSString *image_path = [main_images_dir_path stringByAppendingPathComponent:name];

return [UIImage imageWithContentsOfFile:image_path];

}

而在iOS7下,返回的UIImage是nil。原因是在iOS7下,必须要加上.png或者@2x.png,否则[UIImage imageWithContentsOfFile:image_path]是无法争取找到文件路径的。

相关文章

网友评论

      本文标题:iOS7兼容

      本文链接:https://www.haomeiwen.com/subject/czdtpttx.html