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.