Reputation: 11
I'm trying the iCarousel, there is a function that deletes the view's index and the array's index,
NSInteger index = carousel.currentItemIndex;
[carousel removeItemAtIndex:index animated:YES];
[imagesArray removeObjectAtIndex:index];
I'm deleting it until one item remains, then if one item remains I want to insert the duplicate of it. I tried this:
insertItemAtindex:carousel.currentItemIndex
but it's inserting the last View.
But what I wanted is to insert carousel's/imagesArray last object/index in my view. How can I implement it, or how can I determine an NSMutableArray's last object that is left in the view?
Upvotes: 0
Views: 7200
Reputation: 11839
You can check for last object using -
int count = [yourArray count];
[yourArray objectAtIndex:count - 1]; //this will always return you last object
Upvotes: 3