I am trying to load names in an array using UIAlert and then print them one by one. I can not figure this out can anyone help me with this. I would really your help apprecaite
A:
NSArray *array = [NSArray arrayWithObjects:@"One", @"Two", @"Three", @"Four", nil];
for (NSString *element in array)
{
// Log to console..
NSLog(@"element: %@", element);
//Show in alert.. Really??
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"ALERT TITLE" message:element delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
Prakash
2009-11-26 18:53:31
A:
NSArray *array = [NSArray arrayWithObjects:@"One",@"Two",@"Three",nil]; UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"ALERT TITLE" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; for(NSInteger index=0; index<[array count]; index++) { [alert addButtonWithTitle:[array objectAtIndex:index]]; }