0

NSAlertアプリの 3 回目、10 回目、20 回目の起動時に表示する必要があります。

/* Note that the kLaunchCount is incremented as a Number in a dictionary */
if([[[NSUserDefaults standardUserDefaults] objectForKey:@"kLaunchCount"] intValue] == 1||2||3)
{
    /* show the NSAlert */
}

上記のコードは、NSAlertすべての起動を示しています。

4

1 に答える 1

1

そのコードは として解析され...||2||3、常に true を返します (すべて|| 2が true であるため)。起動回数を変数に入れてから、テストとしてn使用する必要があります。n == 3 || n == 10 || n == 20

于 2011-02-19T03:38:23.700 に答える