簡體   English   中英

如何使用鍵盤快捷鍵將方法參數分配給屬性

[英]How to assign a method parameter to a property using a keyboard shortcut

有沒有一種方法可以使用鍵盤命令將方法參數分配給屬性? 在這種情況下,我嘗試使用“提取字段”,但是IDE出錯了。 一個常見的用例是從對象的構造函數中分配屬性。

-(id)initWithVariable:(NSNumber*)variable {
   self = [super init];
   if ( self ) {
       // Need a way to do this with a keyboard command:
       self.variable = variable
   }
   return self;
}

現在,我能找到的最好的方法是物理輸入self.variable = variable ,然后執行[Alt] + [Enter]以這種方式添加屬性,但是不必鍵入每次將信息輪流到IDE中。

類型: variable; 然后,您可以提取屬性並獲得所需的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM