的使用我的新目標C.目標C方法的命名規則 - 結腸
它說:所有參數之前
使用關鍵詞。 正確的做法:
- (void)sendAction:(SEL)aSelector toObject:(id)anObject forAllCells:(BOOL)flag;
錯誤方式:
- (void)sendAction:(SEL)aSelector :(id)anObject :(BOOL)flag;
它混淆了我關於Objective-C的方法名。這是我的問題:
1.
不推薦使用錯誤的方法。但這是完全合法的,對嗎?
2.
名稱(?簽名)方法的是sendAction:toObject:forAllCells:用於第一和一個sendAction :::爲第二個。對? 我注意到,人們強調冒號:總是作爲方法名稱計數。 我假設:表示參數將會跟隨,無論如何都不能修改。那麼在方法名中包含冒號的含義是什麼,因爲它不受我的修改。
3.
爲了使一個例子,- (無效)sendAction:(SEL)aSelector;
因此該方法的名稱應該是sendAction:
注意到空白處前冒號是名稱的一部分,我認爲這是從不同的方法 - (空)sendAction:(SEL) aSelector;?
答案應該是NO [anObject sendAction:anSel];應該與[anObject sendAction:anSel]相同;
你們如何理解整個計劃是有意義的? 謝謝。
P.S.通過這個問題欣賞你的閱讀。我很肯定,一旦你們中的一些人指出並清除了我的困惑,我會感到無聊。