1

私のクライアントプロジェクトUIAlertViewでは、ボタンを押すだけで作成する必要があります。その部分は難しくなく、上記のコードでそれを行いました:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 1) {

        self.currentCountButtonCount++;

    }if (buttonIndex == 2) {

        self.currentCountButtonCount--;

    }
}

- (IBAction)countClick:(id)sender {

    //self.alertMessage = [[NSString alloc]init];

    // tallies and keeps current count number

    if (!self.currentCountButtonCount)
        self.currentCountButtonCount = 0;

    NSString *alertMessage = [NSString stringWithFormat:@"%d", self.countButtonCount];

    self.countAlert = [[UIAlertView alloc]initWithTitle:@"Count" message:alertMessage delegate:self cancelButtonTitle:@"end" otherButtonTitles:@"+",@"-", nil];

    [self.countAlert show];
}

問題なく動作することがわかりますが、それは私が達成しようとしていたものではありません。

私が必要とするのはUIAlertView、ユーザーが + ボタンを押したときにインクリメントされた文字列に変更されUIAlertViews、 - ボタンが押されたときに減少した値を表示するメッセージです。

上記のコードでこれができると思いましたが、ボタンが押されたときにアラートを閉じるだけです。ユーザーのカウントが完了するまでアラートを維持する必要があります。

これをどのように実装しますか?

カスタムを試してみましたUIAlertViewが、実際にはグラフィック面でのみ役立つようです。

4

1 に答える 1

0

CustomAlertiewcustom を使用してUIView作成delegatesし、この `CustomAlertiew .

于 2013-07-13T05:00:44.217 に答える