嗨剛剛開始學習這種語言,多一個JavaScript/PHP的傢伙......Xcode中 - 建立從多個來源
我似乎無法找出正確的語法和搜索的互聯網絡後,直接答覆或解釋,我決定打擾你SOF社區:
這個工程,我想它的工作:
self.displaysTheStack.text = [self.displaysTheStack.text stringByAppendingString:@" "];
self.displaysTheStack.text = [self.displaysTheStack.text stringByAppendingString:operation];
self.displaysTheStack.text = [self.displaysTheStack.text stringByAppendingString:@" "];
我想知道如果我可以做同樣的事情在更短的線路是這樣的:
NSString *displayTheArrayText = [NSString stringWithFormat:@" ",operation,@" "];
self.displaysTheStack.text = [self.displaysTheStack.text stringByAppendingString:displayTheArrayText];
當我這樣做時,我得到了兩個@「」(空格)但「操作」沒有顯示出來:爲什麼以及如何正確地寫入後一個命令?
未結合到stringWithFormat是連接靜態字符串還是變量字符串的最佳方式?如果我有多個資源操作,操作和執行... – 2012-02-07 18:16:53
'[NSString stringWithFormat:@「%@%@%@%@%@」,operation,op1,op2,op3,op4];'或者使用' NSMutableString就像Rob在他的回答中所使用的那樣。 – 2012-02-07 18:21:28
是啊好吧我嘗試了我現在看到了這個工作現在,謝謝你們...... – 2012-02-07 18:24:42