標簽: iOS Xcode
最近電腦有問題誓斥,經(jīng)常重裝薪者,最痛苦的是Xcode中的代碼塊和插件都要重新安裝,為了方便自己也為了方便他人玉吁,我就把常用的代碼塊貼出來照弥,省的下次還要一個個收集。
人工編輯进副,難免有錯誤这揣,還望大家不吝賜教,/手動抱拳
大家如果有好的也可以分享出來影斑,只為提高我們的開發(fā)效率给赞。
// 懶加載
-(<#type#>) <#name#> {
if (!_<#name#>) {
_<#name#> = <#statements#>
}
return _<#name#>;
}
// 屏幕尺寸
#define k_ScreenWidth [UIScreen mainScreen].bounds.size.width
#define k_ScreenHeight [UIScreen mainScreen].bounds.size.height
// UIwindow
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.window setBackgroundColor:[UIColor blackColor]];
[self.window makeKeyAndVisible];
[self.window setRootViewController:<#(UIViewController * _Nullable)#>];
// UIWidow + UINavigationcontroller
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
[self.window setBackgroundColor:[UIColor <#whiteColor#>]];
[self.window makeKeyAndVisible];
self.window.rootViewController = [[UINavigationController alloc]initWithRootViewController:[<#ViewController#> new]];
// strong
/** <#注釋#> */
@property (strong, nonatomic) <#class#> * <#name#>;
// assign
/** <#注釋#> */
@property (assign, nonatomic) <#type#> <#name#>;
// copy
/** <#注釋#> */
@property (copy, nonatomic) <#type#> <#name#>;
// 代理
/** <#注釋#> */
@property(weak, nonatomic) id <<#classDelegate#>> <#delegateName#>;
- 以下更新于2016.08.10
// UIAlertViewController(彈框視圖)
UIAlertController *<#alert#> = [UIAlertController alertControllerWithTitle:<#title#> message:<#message#> preferredStyle:<#UIAlertControllerStyle#>];
UIAlertAction *<#action#> = [UIAlertAction actionWithTitle:<#@"確定"#> style:<#UIAlertActionStyle#> handler:<#^(UIAlertAction * _Nonnull action)handler#>];
[alert addAction:<#action#>];
[self presentViewController:<#alert#> animated:<#(BOOL)#> completion:<#^(void)completion#>];