I am trying to get the count of an array and add it by 1 in an if statement and it does not seem to work. It causes a crash. Is this the right way to do it or am I doing something wrong?
if (currentPicture == [pictureArray count] +1) {
currentPicture = 0;
}
NSArray‘s range is from0tocount - 1. If you want to “wrap around” by setting the index to 0 once you reach the end, then you have to do:count + 1is one too far.