2011-04-19 4 views
0

NSMutableArray를 사용하고 그 내용을 사용하고 싶습니다. 내 코드는 다음과 같습니다 :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입니다. 어떤 이유로 경보가 표시되지 않습니다.

+1

배열의 내용 대신 일부 정적 문자열을 넣으면 표시됩니까? –

+0

@ 닉 번호 '[_sizedWordList addObject : @ "hello"];'라고 표시해도 표시하려고했지만 작동하지 않습니다. – locoboy

+0

다음과 같이해볼 수 있습니까? [[UIAlertView alloc] initWithTitle : @ "경고"메시지 : @ "메시지"위임 : nil cancelButtonTitle : @ "취소"otherButtonTitles : nil]; –

답변

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