开发者

adjacent date element in array

how to compare an adjacent array element that contains date. The thing is when i compare

BOOL day = [[temp_date objectAtIndex:k] compare:[temp_date objectAtIndex:k+1]];

it throughs the following expection

* Terminating app due to uncaught exc开发者_如何学Goeption 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (23) beyond bounds (23)'

thanks in advance

Regards, sathish


It seems you do everything correct, just check that you're always within array's bounds. If you do that in a loop the condition may be:

for (int k = 0; k+1 <temp_date.count; ++k)
   ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜