iOS7下的一些坑

一、baselineapp

  • 崩溃信息:
    'Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil'
  • 缘由
    baseline只有iOS8之后才有,兼容iOS7就崩溃了,直接移除baseline相关的constraint便可。

二、[[UINavigationBar appearance] setTranslucent:NO]ui

  • 崩溃信息
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c for appearance setter, _installAppearanceSwizzlesForSetter:'
  • 缘由
    iOS8.0以后[UINavigationBar appearance]才能够setTranslucent,兼容iOS7须要添加判断
    if(IOS8_OR_LATER && [UINavigationBar conformsToProtocol:@protocol(UIAppearanceContainer)]) { [[UINavigationBar appearance] setTranslucent:NO]; }
三、在iOS7下若是没有设置navigationController为initController,show会自动将push转换成modal。简而言之就是在sb里每一个show的segue,必须保证它的初始位置有个navigationController。
 
四、XIB 中constrain to margins的关系,iOS8后才有的,把钩去掉。
 
五、 imageFromBundle
在iOS7下,必需要加上 .png或者 @2x.png,不然 [UIImage imageWithContentsOfFile:image_path]是没法争取找到文件路径的。
相关文章
相关标签/搜索