2009-11-26 50 views

回答

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