game maker noob
game maker noob

Reputation: 11

NSMutableArray last Object

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

Answers (2)

Steven Kramer
Steven Kramer

Reputation: 8513

carousel.lastObject !!!!!!!!!!

Upvotes: 9

rishi
rishi

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

Related Questions