[問題] ios計次器顯示不出來

看板MacDev作者 (焱神)時間11年前 (2013/12/28 13:03), 編輯推噓0(004)
留言4則, 4人參與, 最新討論串1/1
我寫了一按鈕 每按一次 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

12/28 13:07, , 1F
[NSString stringWithFormat:@"%d",rrtime]
12/28 13:07, 1F

12/28 13:31, , 2F
噢喔噢 感謝大大解答!!!
12/28 13:31, 2F

12/28 16:03, , 3F
不要吧C++的概念用在Objective-C上
12/28 16:03, 3F

12/29 20:34, , 4F
C++ 也不是這樣寫的吧XD
12/29 20:34, 4F
文章代碼(AID): #1IlbkMGc (MacDev)
文章代碼(AID): #1IlbkMGc (MacDev)