我想使用NSMutableArray然后使用它的内容。我的代码如下:
[_sizedWordList addObject:[_wordList objectAtIndex:i]];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:[_sizedWordList objectAtIndex:0] delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles: nil];
[alert show];
[alert release];
其中_sizedWordList是NSMutableArray
,而_wordList是NSArray
。出于某种原因,警报未显示。
答案 0 :(得分:1)
好吧,你的阵列一定有问题。看,我已经创建了这个小小的工作示例。
NSMutableArray *myArray = [NSMutableArray array];
[myArray addObject:@"Hello everybody"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:[myArray objectAtIndex:0]
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert release];