ios - Plist for persistent data in UITableView between launches -
I have this list, which is called I put it in a UITableView of content .. then I've subclassed the I have made it so that anything in the Now, I want to be able to add data from this plast so that the data remains consistent between the launch (if the user enters more). Here my code has been inserted in my It reaches the point reached, and then zero ... So I'm not sure what I'm doing wrong, besides the table is empty, do someone tell me in the right direction Could? Since your plist root is an array and there is no dictionary, your code should be: If you want the user to add value then But if you want to continue with additional data, you will need to type the array in a writable folder like the document folder. sleeps.plist in my main directory. It seems that
ViewController with
TableView and I have set it as data source and delegate.
NSArray is added to the table (tested with static data).
viewDidLoad my
ViewController subclass.
NSString * path = [[NSBundle mainBundle] pathForResource: @ "sleeps" type: @ "plist"]; NSDictionary * myDict = [[NSDictionary alloc] initWithContentsOfFile: path]; NSArray * myArray = [myDict objectForKey: @ "root"]; Sleeping = [myArray copy]; // Sleep is a NSRY that has been announced after the @Epplimentation Line NSLog (@ "Points at Point"); NSLog (@ "% @", sleeps);
NSString * path = [[NSBundle main bundle] pathForResource: @ "sleeps" type: @ "plist"]; NSArray * myArray = [[NSArray alloc] initWithContentsOfFile: Path]; Sleeping = [myArray copy]; // Sleep is a NSRY that has been announced after the @Epplimentation Line NSLog (@ "Points at Point"); NSLog (@ "% @", sleeps);
flames should be a
NSMutableArray and you
MyArray mutableCopy] .
Comments
Post a Comment