The path to iOS has finally started, and with M A J video Tutorial step-by-step, will add to their new things.
=====TOPIC01 Why would---Use the plist file??? =======
It is not a reasonable practice to directly write data directly into the code. If the data is often changed, it is necessary to turn over the corresponding code to modify, resulting in low code extensibility, so you can consider to put the frequently changed data in the file for storage, the program starts to read the latest data from the file. If you want to change the data, directly modify the data file, without modifying the code can generally use the property list file to store Nsarray or nsdictionary, such as data, this property list file extension is plist, so also become "plist file"
--------------------------------------------------
Parsing data in a plist file
STEP01: Get the full path to the plist file
NSBundle *bundle = [NSBundle mainbundle];//What the bundle this is on the mobile hardware side looking for the main file store!
NSString *path = [Bundle pathforresource:@ "ImageData" oftype:@ "plist"];
STEP02: Loading plist files
_images = [Nsarray Arraywithcontentsoffile:path];
-(Nsarray *) images
{
if (_images = = nil) {
NSBundle *bundle = [NSBundle mainbundle];
NSString *path = [Bundle pathforresource:@ "ImageData" oftype:@ "plist"];
_images = [Nsarray Arraywithcontentsoffile:path];
}
return _images;
}
Day01-ios (Plist)