看板 MacDev 關於我們 聯絡資訊
我寫了一按鈕 每按一次 label 就會加一 但是我寫在 .m code 如下 @implementation RTViewController @synthesize rr, displaytime; int rrtime; // declare count number <--變數宣告在這裡 - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } int rrtime; - (IBAction)startpause:(UIButton *)sender{; } - (IBAction)rrcouner:(UIButton *)sender{ rrtime++; // while push the bottom rrtime plus 1 <--按下以後加一 rr.text=@"%d",rrtime; //display the value <--輸出 } - (IBAction)enterdata:(UIButton *)sender{;} } 下面省略 但是我用模擬器跑出來 他一直都是顯示 "%d" 沒有run-time error 但是跳出 expression result unused的警告訊息 請問我該怎們辦T_T 小弟初學者 只有基礎C++的知識 謝謝解答 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 23.17.129.33
yuanruo:[NSString stringWithFormat:@"%d",rrtime] 12/28 13:07
firemonny:噢喔噢 感謝大大解答!!! 12/28 13:31
darktt:不要吧C++的概念用在Objective-C上 12/28 16:03
uranusjr:C++ 也不是這樣寫的吧XD 12/29 20:34