iOS7下的一些坑

1、baseline

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

2、[[UINavigationBar appearance] setTranslucent:NO]

  • 崩溃信息
    *** 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];
      }
3、在iOS7下如果没有设置navigationController为initController,show会自动将push转换成modal。简而言之就是在sb里每个show的segue,必须保证它的初始位置有个navigationController。
 
4、XIB 中constrain to margins的关系,iOS8后才有的,把钩去掉。
 
5、 imageFromBundle
在iOS7下,必须要加上.png或者@2x.png,否则[UIImage imageWithContentsOfFile:image_path]是无法争取找到文件路径的。
posted @ 2016-08-15 10:39  会飞的夜良  阅读(94)  评论(0)    收藏  举报