2012-05-08 7 views
-5

私はint値が特定の数値以上であれば何かをしたいと思うアプリケーションを持っていますし、それを行う方法を理解できないようですそれはまさに量ですが、それ以上のものではありません。ifステートメント - 特定の値以上

例えば、私は0のint値を持ち、ボタンを押すたびにその値が上がります.20以上になると、別のボタンが押されたときに何かをしたいと思っています。

彼が助けてくれてありがとう!

- (IBAction)storeTroll:(id)sender { 
    if (count == 20) { 
     trollButton.hidden = NO; 
    } 
} 
+3

を、あなたは '' {...}(> = 20カウント)場合を意味していますか? –

答えて

3
Operator Description 
x == y Returns true if x is equal to y 
x > y Returns true if x is greater than y 
x >= y Returns true if x is greater than or equal to y 
x < y Returns true if x is less than y 
x <= y Returns true if x is less than or equal to y 
x != y Returns true if x is not equal to y 

ので、> =を使用します。

- (IBAction)storeTroll:(id)sender { 
    if (count >= 20) { 
     trollButton.hidden = NO; 
    } 
} 
関連する問題