All Things Mobile

The Latest News & Knowledge

Moving objects in an NSMutableArray

A glaring omission from the NSMutableArray class is the ability to move an object from one index to another. There are methods for adding and deleting objects but not for simply moving. One great approach is to use a category on NSMutableArray. When we were looking to optimize our code we found a very well documented blog post on this topic so we’ll just point you to our original source. It’s quite useful and very simple to implement.



http://www.icab.de/blog/2009/11/15/moving-objects-within-an-nsmutablearray/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>