1

On my client project I need to create a UIAlertView on a button press. That part is not hard and have done it with said code:

- (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];
}

You will see there that works without flaw, but it's not what I was trying to achieve.

What I need is for the message of the UIAlertView to change to the incremented string when the user presses the UIAlertViews + button and show the decreased value when the - button is pressed.

I thought the code above would do this, it just dismisses the Alert when any button is pressed. I need it to keep the Alert up until the user is done counting.

How would I implement this?

I have tried a custom UIAlertView but it seems to really only help on the graphics side of things.

Gabriel.Massana
  • 8,165
  • 6
  • 62
  • 81
Keeano
  • 309
  • 8
  • 33
  • As you were told in your previous question, this can't be done with `UIAlertView`. You need to find (or create your own) a custom alert view class that allows for the message to be updated while still being displayed. – rmaddy Jul 13 '13 at 04:05
  • I understand that, but how would i address that in the custom class? @rmaddy – Keeano Jul 13 '13 at 04:17
  • Maybe you know a good example online i could look at or know how to explain it? @rmaddy – Keeano Jul 13 '13 at 04:18
  • I don't know a specific custom alert view but try github or cocoacontrols. – rmaddy Jul 13 '13 at 04:26

1 Answers1

0

You can creeate a CustomAlertiew by using custom UIView And then create delegates for this `CustomAlertiew.

Divyam shukla
  • 2,038
  • 14
  • 18