Mc.*_*ver 0 cocoa-touch objective-c ios
我是在一个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]];
Run Code Online (Sandbox Code Playgroud)
但是当照片到达最后一页时,应用程序将崩溃,调试器消息:
'NSRangeException', reason: '-[__NSCFArray objectAtIndex:]: index (30) beyond bounds (30)'
*** First throw call stack:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
126 次 |
| 最近记录: |