in my NSMutableArray there are constantly objects added to it while the app is running.
What I want to do is, to have a maximum number of rows in that array (lets say 50). So once the array count reaces 50 I want the last row (first row added row) to be deleted. Something like in the messages app where there is only a certain numbers of rows visible.
How would I do this?
Thanks alot!
In the section where you're adding items onto the NSMutableArray, just check the count of the array before putting a new item onto it, and remove the oldest item first if it's at maximum length.
Or, if you're adding items to the array in a lot of places, and don't want to be putting those checks everywhere, you could subclass NSMutableArray and do the check in your own insert method.