Core Data
Managed Object Model: Defne the data you want to store.
Entty: This is an individual data object. In a database it'd be a table.
Atribute. This is an individual variable stored inside an entty. In a database it'd be a column.
Managed Object: The object representaton of an entty you defned. You create, modify, and store those while using core data.
Managed Object Context: Sort of a temporary storage area. You take enttes from the persistent store and put them here to modify them. Afer
you're done with them, they will be safely put back in the persistent store.
Persistent Storage Coordinator: Coordinates your managed object model and the persistent store. You just set it up and it takes care of everything.
Insert data:
MyData *myData = (MyData *)[NSEntityDescription insertNewObjectForEntityForName:@"MyData" Insert a new object for a specifed entty. This corresponds to insertng a row into a table. You need to know the class representng your entty (MyData) and the name of the entty in the persistent store ("MyData").
Afer myData was created, assign its propertes to the values you want it to store. (Like myData.name = @"foo".) objCon is your managed object context. Call its save method when you want the new object to be actually inserted.
Retrieve data (ALL objects of an entty):
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"MyData" [fetchRequest setEntity:entity];NSError *error; NSArray *items = [objCon executeFetchRequest:fetchRequest error:&error]; Create a NSEnttyDescripton. This means to tell the managed object context what entty you want to retrieve. The fetchRequest also needs to know this entty. Start the retrieval of all objects of the entty by executng the fetchRequest. This returns an array of MyData objects you can now work with. Keep in mind that it may be empty.
Retrieve data (only selected objects of an Entty):
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id=%i",id];[fetchRequest setPredicate:predicate]; Afer you created a fetchRequest, create a NSPredicate. The predicate consists of a formated string which is like the where-clause of SQL.
Tell the fetchRequest to use that predicate to flter the objects it retrieves when executed.
Delete data:
Use a fetchRequest to retrieve an object like myData which you want to delete.
Call the deleteObject method on the managed object context, tell it which managed object you want to be deleted.
Don't forget to save the objCon. This actually deletes the myData object.
Sort data on retrieval:
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"myAttribute" [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]]; [sort release]; Create a fetchRequest, an entty descripton and a predicate.
Create a NSSortDescriptor, which you tell the atribute used for sortng, and the order (ascending:NO for descending order).
Tell the fetchRequest to use that sort descriptor. It is capable of using more than one, so you have to put it in an array.
Execute the fetchRequest as usual. The resultng array is now sorted.

Source: http://timotaglieber.de/misc/core_data-cheatsheet.pdf

Colorado mountain medical,pc

Colorado Mountain Medical,PC Stephen P. Laird, M.D. Gastroenterology & Hepatology Midvalley Ambulatory Surgery Center 1450 E Valley Rd, # 202 Basalt, CO 81621 970-544-1360 EGD /Colonoscopy and/or Flexible Sigmoidoscopy Preparation Instructions Your test is scheduled for the following facility: Midvalley Ambulatory Surgery Center on: (Please arrive 1 hour before pr


Swine Flu Following cases of swine flu Influenza A (H1N1) in Canada, Mexico, and the United States, the World Health Organization (WHO) has raised the level of influenza pandemic alert from phase 3 to phase 4. There are no confirmed cases reported in Toronto or Ontario at this time. Toronto Public Health is working with the Ministry of Health and Long-Term Care and the Public Health Agenc

Copyright © 2010-2014 Internet pdf articles