开发者

iPhone Development xcode : Putting user input (names) into text array

I am trying to load names in an array using UIAlert and then print them one by one. I am not able to figure this out, c开发者_高级运维an anyone help me out with this? I would really appreciate your help.


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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜