2012-06-27 4 views
-2

iOS에 익숙하지 않았습니다. Android도 공부하고 있습니다. 배열에 다소 혼란 스럽습니다. 인덱스를 인덱스혼란스러운 배열

for(x = 0; x < array.size; x++) 
{ 
    if(result < nextresult[x]) 
     nextresult[x] -= 1; 
} 

가해야 할 경우 그것은 배열의 모든 콘텐츠를 iccheck 것의

nextresult[x] 배열 것으로

result : 아이폰 OS에이를 변환하는 방법

조정 여부,

답변

2

다음과 같을 수도 있습니다 - 나처럼 ntioned, 나는 다음을 고려했습니다 - result' is value and nextresult`는 배열입니다.

for(x = 0; x < [array count]; x++) 
{ 
    if(result < [nextresult objectAtIndex:x]) { 
     [nextresult objectAtIndex:x] -= 1; 
    } 
} 

편집 - 당신이 배열에 정수를 추가 할 경우 -

[yourArray addObject:[NSNumber numberWithInt:1]]; // Objective C array store objects. so we need to convert primitive data type into object. 
+0

NSMutableArray를 button.tag을 기반으로하는 방법은 다음과 같이 저장합니다. NSUserDefaults * prefs = [NSUserDefaults standardUserDefaults]; [prefs setInteger : 1 forKey : @ "Key"]; – Bazinga

+0

@user - 편집 된 게시물을 확인하십시오. – rishi

2

을 애플의 우수한 개발자 설명서를 참조하십시오.

NSArray 클래스 here 또는 Xcode 구성 도우미에 대한 문서를 찾을 수 있습니다.

난 그냥 쉽게 문서를보고 해결할 수 있기 때문에 나는 당신의 질문을 downvoted있다.