天天看點

XCode中在提示視窗中對已棄用的API接口畫上紅線

當我們在XCode中敲代碼時會不斷的出現相關API提示視窗,那敲起來是一個爽啊。

XCode中在提示視窗中對已棄用的API接口畫上紅線

有時候會看到一些API已經棄用了被畫上紅色的橫線,說明該接口已經被棄用,仍保留,但不建議使用,對棄用API實作畫橫線其實很簡單,隻需要在接口檔案(.h)中這樣寫即可實作上圖效果,很簡單吧。

/*!
 DEPRECATED: Use the [CustomIOS7AlertView init] method without passing a parent view.
 */
- (id)initWithParentView: (UIView *)_parentView __attribute__ ((deprecated));
           

為接口添加接口說明:

XCode中在提示視窗中對已棄用的API接口畫上紅線
/**設定app的友盟appKey,此appKey從友盟網站擷取

 @param appKey 友盟appKey
 */

+ (void)setAppKey:(NSString *)appKey;