Carthage
安装:brew install carthage
添加:Cartfile
运行:carthage update
添加:Carthage/Build/.framework
防止重复push/present类型相同的controller
- 找到最上层view controller;
- 判断最上层view controller与待展示view controller是否类型相同;
- 如果类型不同,才进行操作。
获取最底层view controller:
[UIApplication sharedApplication].delegate.window.rootViewController
。
获取最上层view controller:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Create Groups vs Create Folder References
Group:不创建文件夹,不能同名;
Folder:创建文件夹,可以重名;
拉伸Image
代码:- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode NS_AVAILABLE_IOS(6_0);
设置:Assets -> Attributes Inspector -> Slicing
隐藏文件
显示隐藏文件:defaults write com.apple.finder AppleShowAllFiles -bool true
隐藏隐藏文件:defaults write com.apple.finder AppleShowAllFiles -bool false
重启finder:killall Finder
NavigationBar & ScrollView
自动:contentOffset.y == -64
手动:self.edgesForExtendedLayout = UIRectEdgeNone;
,y轴0点下移64。
Objective-C static vs external
static: In C and Objective-C, a static variable or function at global scope means that that symbol has internal linkage.
external: If you want to have a single global variable, you can’t have it in class scope like in C++. One option is to create a global variable with external linkage: declare the variable with the extern keyword in a header file, and then in one source file, define it at global scope without the extern keyword.