How to empty an NSMutableArray ?


Sometimes you may need to empty an NSMutableArray which is already initialized with some objects. You don’t need to release it and again alloc it for future use! You can simply empty an NSMutableArray using the following line of code.

[yourArray removeAllObjects];

Here ‘yourArray’ is your 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=""> <s> <strike> <strong>