bounds就是屏幕的全部区域,
applicationFrame就是app显示的区域,不包含状态栏(高度20,如果状态栏隐藏的话,那么,这个结果就和bounds一样了)
UIImage 加载图片使用“[UIImage imageNamed:@"xxx.png"]时,系统会把图像Cache到内存。如果图像比较大,或者图像比较多,用这种方式会消耗很大的内存,而且释放图像的内存是一件相对来说比较麻烦的事情。例如:如果利用imageNamed的方式加载图像到一个动态数组,然后将将数组赋予一个UIView的对象的进行逐帧动画,那么这将会很有可能造成内存泄露。解决上述问题的最佳方法是:
1 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) { |
2 | [UIImage initWithCGImage:[[UIImage imageWithData:[NSData dataWithContentsOfFile:@ "xxx@2x.png" ]] CGImage] scale:2.0 orientation:UIImageOrientationUp]; |
3 | } else { |
4 | [UIImage imageWithContentsOfFile:@ "xxx.png" ]; |