iOS QMUI總結(jié)的代碼片段

QMUI代碼片段

GitHub地址:https://github.com/QMUI/QMUI_iOS_CodeSnippets
可以下載到本地
快捷鍵匯總

NSObject

  • pa - 定義一個 assign 的 property
  • par - 定義一個 assign, readonly 的 property
  • pc - 定義一個 copy 的 property
  • pcr - 定義一個 copy, readonly 的 property
  • ps - 定義一個 strong 的property
  • psr - 定義一個 strong, readonly 的property
  • pw - 定義一個 weak 的property
  • pwr - 定義一個 weak, readonly 的property
  • load_once - 創(chuàng)建一個帶 dispatch_once 的 +load 方法
  • propertySwizzleAssign - 用 swizzle 的方式定義一個 assign 的property
  • propertySwizzleCopy - 用 swizzle 的方式定義一個 copy 的property
  • propertySwizzleStrong - 用 swizzle 的方式定義一個 strong 的property
  • propertySwizzleWeak - 用 swizzle 的方式定義一個 weak 的property
  • sharedInstance - 為當(dāng)前類創(chuàng)建一個實現(xiàn)單例功能的 sharedInstance 方法
  • exchangeImplementation - 重寫當(dāng)前類的 load 方法并在其中用 swizzle 替換方法實現(xiàn)
  • exchangeImplementation_QMUI - 用 QMUI 重寫當(dāng)前類的 load 方法并用 ExchangeImplementations() 函數(shù)替換方法的實現(xiàn)
  • exchangeMultipleImplementations_QMUI - 用 QMUI 重寫當(dāng)前類的 load 方法并用 ExchangeImplementations() 函數(shù)批量替換多個方法的實現(xiàn)
  • override_void_non_argv - 用 QMUI 的 OverrideImplementation() 重寫指定 class 的某個無返回值、無參數(shù)的方法實現(xiàn)
  • override_void_single_argv - 用 QMUI 的 OverrideImplementation() 修改指定 class 的某個無返回值、帶一個參數(shù)的方法實現(xiàn)
  • override_void_two_argvs - 用 QMUI 的 OverrideImplementation() 修改指定 class 的某個無返回值、帶兩個參數(shù)的方法實現(xiàn)
  • override_return_non_argv - 用 QMUI 的 OverrideImplementation() 修改指定 class 的某個帶返回值、無參數(shù)的方法實現(xiàn)
  • override_return_single_argv - 用 QMUI 的 OverrideImplementation() 修改指定 class 的某個帶返回值、帶一個參數(shù)的方法實現(xiàn)
  • override_return_two_argvs - 用 QMUI 的 OverrideImplementation() 修改指定 class 的某個帶返回值、帶兩個參數(shù)的方法實現(xiàn)
  • extend_void_non_argv - 用 QMUI 的 ExtendImplementationOfVoidMethodWithoutArguments() 修改指定 class 的某個無返回值、無參數(shù)的方法實現(xiàn)
  • extend_void_single_argv - 用 QMUI 的 ExtendImplementationOfVoidMethodWithSingleArgument() 修改指定 class 的某個無返回值、帶一個參數(shù)的方法實現(xiàn)
  • extend_void_two_argvs - 用 QMUI 的 ExtendImplementationOfVoidMethodWithTwoArguments() 修改指定 class 的某個無返回值、帶兩個參數(shù)的方法實現(xiàn)
  • extend_return_non_argv - 用 QMUI 的 ExtendImplementationOfNonVoidMethodWithoutArguments() 修改指定 class 的某個帶返回值、無參數(shù)的方法實現(xiàn)
  • extend_return_single_argv - 用 QMUI 的 ExtendImplementationOfNonVoidMethodWithSingleArgument() 修改指定 class 的某個帶返回值、帶一個參數(shù)的方法實現(xiàn)
  • extend_return_two_argvs - 用 QMUI 的 ExtendImplementationOfNonVoidMethodWithTwoArguments() 修改指定 class 的某個帶返回值、帶兩個參數(shù)的方法實現(xiàn)

Block

  • blockParameterInMethod - 聲明一個用于 OC 方法參數(shù)的 block
  • blockParameterInFunction - 聲明一個用于 C 函數(shù)參數(shù)的 block
  • blockproperty - 聲明一個用于 property 的 block
  • blocktypedef - 用 typedef 定義一個 block
  • blockvar - 定義一個作為局部變量的 block

Method & Function

  • fnv - 定義一個返回值為 void 的方法
  • fnv: - 定義一個返回值為 void 且?guī)?shù)的方法
  • fnblock - 定義一個返回值類型為 block 的方法
  • fnv_handleEvent - 定義一個用于 UIControl 事件回調(diào)的方法
  • fnv_longPress - 定義一個用于 UILongPressGestureRecognizer 的回調(diào)方法(你就不用每次都去拼寫那個很長的手勢名字了)
  • fnv_pan - 定義一個用于 UIPanGestureRecognizer 的回調(diào)方法
  • fnv_tap - 定義一個用于 UITapGestureRecognizer 的回調(diào)方法

UIView

  • setFrame - 為 UIView 設(shè)置 frame
  • setFrame_QMUI - QMUI 使用像素對齊的 CGRectFlatMake() 為 UIView 設(shè)置 frame
  • setFrameX - QMUI 使用 CGRectSetX() 修改 UIView 的 frame.origin.x
  • setFrameY - QMUI 使用 CGRectSetY() 修改 UIView 的 frame.origin.y
  • setFrameXY - QMUI 使用 CGRectSetXY() 修改 UIView 的 frame.origin
  • sizeThatFits - 為當(dāng)前 view 創(chuàng)建 sizeThatFits: 方法
  • layoutSubviews - 展開 layoutSubviews 方法
  • updateConstraints - 展開 updateConstraints 方法
  • getWidth - 展開 CGRectGetWidth()
  • getHeight - 展開 CGRectGetHeight()
  • getMinX - 展開 CGRectGetMinX()
  • getMinY - 展開 CGRectGetMinY()
  • addtarget - 調(diào)用 UIControl addTarget:action:forEvents: 方法
  • setImageForButton - 為 UIButton 設(shè)置圖片
  • setTitleColorForButton - 為 UIButton 設(shè)置文字顏色
  • setTitleForButton - 為 UIButton 設(shè)置文字

UITableView

  • initWithStyle - 展開 initWithStyle: 方法
  • initWithStyleForCell - 展開 UITableViewCell initWithStyle:reuseIdentifier: 方法
  • tableViewDelegate - 展開常用的幾個 UITableViewDelegate 方法
  • numberOfSectionsInTableView - 展開 numberOfSectionsInTableView:方法
  • numberOfRowsInSection - 展開 tableView:numberOfRowsInSection: 方法
  • cellForRowAtIndexPath - 展開 tableView:cellForRowAtIndexPath: 方法
  • heightForRowAtIndexPath - 展開 tableView:heightForRowAtIndexPath: 方法
  • didSelectRowAtIndexPath - 展開 tableView:didSelectRowAtIndexPath: 方法

UICollectionView

  • collectionViewDelegate - 展開常用的幾個UICollectionViewDelegate 方法
  • numberOfSectionsInCollectionView - 展開 numberOfSectionsInCollectionView:
  • numberOfItemsInSection - 展開 collectionView:numberOfItemsInSection:
  • cellForItemAtIndexPath - 展開 collectionView:cellForItemAtIndexPath:
  • sizeForItemAtIndexPath - 展開 collectionView:layout:sizeForItemAtIndexPath: 方法
  • didSelectItemAtIndexPath - 展開 collectionView:didSelectItemAtIndexPath: 方法
  • didDeselectItemAtIndexPath - 展開 collectionView:didDeselectItemAtIndexPath: 方法

UIViewController

  • initWithNib - 展開 initWithNibName:bundle: 方法
  • didInitialize - 展開某些 QMUI 控件提供的 didInitialize 方法
  • didInitializeWithStyle - 展開 QMUICommonTableViewController 的 didInitializeWithStyle: 方法
  • loadView - 展開 loadView 方法
  • viewDidLoad - 展開 viewDidLoad 方法
  • viewWillAppear - 展開 viewWillAppear: 方法
  • viewDidAppear - 展開 viewDidAppear: 方法
  • viewWillDisappear - 展開 viewWillDisappear: 方法
  • viewDidDisappear - 展開 viewDidDisappear: 方法
  • viewDidLayoutSubviews - 展開 viewDidLayoutSubviews: 方法
  • updateViewConstraints - 展開 updateViewConstraints: 方法
  • addChildViewController - 在當(dāng)前 UIViewController 里添加 childViewController
  • removeFromParentViewController - 將 childViewController 從當(dāng)前的 UIViewController 里移除
  • initSubviews - QMUI 展開 initSubviews 方法
  • setupNavigationItems - QMUI 重寫 QMUICommonViewController 里的 setupNavigationItems 方法
  • setupToolbarItems - QMUI 重寫 QMUICommonViewController 里的 setupToolbarItems 方法

UIBarButtonItem

  • backItem - 用 QMUI 方法生成一個返回按鈕
  • boldTitleItem - 用 QMUI 方法生成一個文字加粗的導(dǎo)航欄按鈕
  • closeItem - 用 QMUI 方法生成一個導(dǎo)航欄上的關(guān)閉圖標(biāo)按鈕
  • imageItem - 用 QMUI 方法生成一個導(dǎo)航欄上的圖片按鈕
  • titleItem - 用 QMUI 方法生成一個導(dǎo)航欄上的文字按鈕

Other

  • pragma - 展開一個用于 Xcode 導(dǎo)航的 #pragma mark - 宏
  • log - 展開 NSLog(@"xxx")
  • osif - 展開一個 @available(iOS xxx, *) 的 if 判斷
  • externRefInH - 在 *.h 文件里聲明一個 extern const 的指針
  • externRefInM - 在 *.m 文件里為一個 extern const 的指針賦值
  • externValueInH - 在 *.h 文件里聲明一個 extern const 的值變量
  • externValueInM - 在 *.m 文件里為一個 extern const 的變量賦值
  • static reference - 定義一個 static 的指針
  • static - 定義一個 static 的值變量
  • __weakSelf - 定義一個 weak 的 self 指針
  • __strongSelf - 將 weakSelf 指針改為 strong 的 self 指針
  • logCallStackSymbols - 用 NSLog 打出當(dāng)前的方法調(diào)用棧信息
  • timeConsuming - 展開一段用 CACurrentMediaTime() 來計算方法耗時的代碼
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容