Regular NSArray is Immutable , i,e whenever you create an NSArray object and initialize some values to that and later sometime in the project if u have to add some value or object to that instance of an array it won't let u do that.
NSArray *myArray = [NSArray arrayWithObjects: @"1", @"two", @"3", nil];
Here unlike the C-style Arrays you don't explicitly declare the size of an array, it will automatically does it until it hits nil.
The problem here is, sometime later if u want to add or remove object , you will not be able to do with the regular arrays. NSMutableArray which is the subclass of NSArray does this for you.
NSMutableArray *myArray = [NSArray arrayWithObjects: @"1", @"two", @"3", nil];
sometime later if you want to add a string or object to this array, there are methods in NSMutableArray which lets you to do this.
[myArray addObject: @"four"];
[myArray removeObjectAtIndex:2];
NSArray *myArray = [NSArray arrayWithObjects: @"1", @"two", @"3", nil];
Here unlike the C-style Arrays you don't explicitly declare the size of an array, it will automatically does it until it hits nil.
The problem here is, sometime later if u want to add or remove object , you will not be able to do with the regular arrays. NSMutableArray which is the subclass of NSArray does this for you.
NSMutableArray *myArray = [NSArray arrayWithObjects: @"1", @"two", @"3", nil];
sometime later if you want to add a string or object to this array, there are methods in NSMutableArray which lets you to do this.
[myArray addObject: @"four"];
[myArray removeObjectAtIndex:2];
Nice one ... it helps me to understand the difference.
ReplyDeleteThank you.
HI am beginner and Am working As a Ios Developer in Level 2company. Will thr be much scope in future and wat all are companies wil hav Ios application.. can u suggest me
ReplyDeletenow what are u doing i just wanna knw
DeleteYou could just work harder and write an original answer instead of copying it verbatim from Stackoverflow, right?
ReplyDeleteplease explain me atomic and nonatomic with example
ReplyDeletehttps://www.quora.com/What-is-the-difference-between-strong-retain-nonatomic-etc-in-the-Objective-C-iOS-property
Deletenice example
ReplyDeleteExcellent…Amazing…. I’m satisfied to find so many helpful information here within the put up,for latest php jobs in near me. we want work out extra strategies in this regard, thanks for sharing.
ReplyDeleteTop SEO Company The best known mobile App design and development company based in Lahore Pakistan. Get applications for Android, iOS, HTML5, Windows.
ReplyDeleteIOS Apps Development in Lahore
real estate whatsapp groups
ReplyDeleteThis comment has been removed by the author.
ReplyDelete