现在 iOS7已经发布了有一段时间,想必大家都已经熟悉了ios6 、7的一些新的写法,而目前还是有一些客户是ios5 的系统的,因此可能会遇到不能正常登录和使用的问题,这次我也是遇到了 ,由于ios5只在10.8.5及之前的系统版本上支持,所以要找测试环境还是比较麻烦的。
在应用程序中,如果使用了定义图片的函数
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets NS_AVAILABLE_IOS(5_0); // create a resizable version of this image. the interior is tiled when drawn.
或者是
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode NS_AVAILABLE_IOS(6_0); // the interior is resized according to the resizingMode
就会有相应的问题出现 带有 resizingMode参数的方法 是ios6才支持的,这个当时未发现
解决方法:
推荐的兼容宏
#ifndef ResizableImageWithCapInsets
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000
#define ResizableImageWithCapInsets(__outImageObject, __imageObject,__edgeInsets)
UIImage *__outImageObject = [__imageObject resizableImageWithCapInsets:__edgeInsets];
#else
#define ResizableImageWithCapInsets(__outImageObject, __imageObject,__edgeInsets)
UIImage *__outImageObject = [__imageObject resizableImageWithCapInsets:__edgeInsets resizingMode:UIImageResizingModeTile];
#endif
#endif
还有就是关于 ios6需要为cell 注册 nib 或者 class
- - (void)registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(5_0);
- - (void)registerClass:(Class)cellClass forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0);</span>
之后就可以使用
dequeueReusableCellWithIdentifier:forIndexPath:来获得一个cell实例。