Skip to content

Instantly share code, notes, and snippets.

@cleexiang
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleexiang/2cee4d774ca42406e768 to your computer and use it in GitHub Desktop.
Save cleexiang/2cee4d774ca42406e768 to your computer and use it in GitHub Desktop.
iOS开发常见问题解决汇总

###iOS开发常见问题解决汇总

####代码篇

  • 隐藏空白cell的分割线

    UIView *footer =[[UIView alloc] initWithFrame:CGRectZero]; myTableView.tableFooterView = footer; [footer release];

  • 通过NSURL初始化本地路径的时候最好使用fileURLWithPath,这样系统会自动加上file://前缀,否则使用NSURL时可能会提示错误

  • iOS8由于路径变化,现在通过NSSearchPathForDirectoriesInDomains获取的路径会产生一个随机路径,所以应用中应该保存相对路径。

  • [NSCalendar currentCalendar]会比较耗时,可以通过全局变量或者属性保存起来

####工具篇

  • 打印CoreData调试信息,需要添加参数-com.apple.CoreData.SQLDebug

  • po [[UIWindow keyWindow] recursiveDescription] 可以打印当前视图的层级结构

  • po [[[UIWindow keyWindow] rootViewController] _printHierarchy] 可以打印当前视图控制器的层级结构

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment