UIAlertView temsilci u herhangi bir düğmeye tıklayarak her zaman denilen olsun "didDismissWithButtonIndex".
bu deneyin:
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Message"
message:messageString
delegate:self
cancelButtonTitle:@"Back"
otherButtonTitles:@"Reply",@"Delete",nil];
[alert show];
[alert release];
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1)
{
NSLog(@"Reply");
UIAlertView *myalert = [[UIAlertView alloc] initWithTitle:@"Button Clicked" message:@"U clicked Reply " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myalert show];
[myalert release];
}
if (buttonIndex == 2)
{
NSLog(@"Delete");
UIAlertView *myalert = [[UIAlertView alloc] initWithTitle:@"Button Clicked" message:@"U clicked Delete " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myalert show];
[myalert release];
}
}
Its değil dong şey i bu düğmelerin herhangi tıkladığınızda. – Ashutosh
Güncel kodu bul – iPhoneDev
Doğru cevap. İpucu: "didDismissWithButtonIndex" (UIAlertView * ekran hiyerarşisini terk ettikten sonra * başlatıldı), "clickedButtonAtIndex" ile karıştırmayın (UIAlertView hala ekrandayken ve ekranın hiyerarşisini önemli ölçüde etkiliyorken ve kısmen etkiliyorken çağrılır). Bu karışımı diğer StackOverflow cevaplarında ve web'deki diğer yerlerde buldum. –