plist 파일의 값을 계산하는 데 문제가 있습니다. 문제는 if 문이 값이 내 plist의 개체보다 큰지 확인한 후 다음 페이지로 이동하지 못하게하는 문제입니다. 코드 만 : [배열 수]와 관련된 문제
picturesDictionary = [NSDictionary dictionaryWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"images" ofType:@"plist"]];
arrays = [picturesDictionary objectForKey:@"PhotosArray"];
int photoCount = [arrays count];
if ((photoNumber < 1) || (photoNumber > photoCount)) return nil;
controller = [BookController rotatableViewController];
PhotosInAlbum.image = [UIImage imageNamed:[arrays objectAtIndex:pageNumber]];
하지만 사진은 마지막 페이지에 도달하면 이후
는 응용 프로그램이 충돌합니다, 디버거 메시지 :'NSRangeException', reason: '-[__NSCFArray objectAtIndex:]: index (30) beyond bounds (30)'
*** First throw call stack:
'[NSArray count]'는 마지막 항목의 색인이 아니라 배열의 항목 수를 알려줍니다. – Manuel