Posts Categorized: Magical Record

Magical Records: Edit, Add, and Delete Records

First, we need some buttons to let us perform some actions on the table. Edit your view controller as follows: – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self setupView]; [self setupFetchedResultsController]; } – (void)setupView { // Create Edit Button UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:@”Edit” style:UIBarButtonItemStyleBordered target:self action:@selector(editNotes:)];… Read more »

TableViewController: Detail View

Now we have a list, lets create a detail view for each note. First, create a new view controller (File>New>New File>Cocoa Touch>Objective-C Class) named NoteDetailViewController that is a subclass of UIViewController. Next, drag out a new View Controller in Interface Builder, give it the custom class NoteDetailViewController and add 2 labels and a textview (make sure it is not editable… Read more »

Magical Record: Simple Core Data

Installation Personally I hate adding libraries by simply dragging and copying files into my code. The mixing between my own code and external libraries can quickly become confusing and difficult to disentangle. My favourite way to add libraries is Cocoa Pods. It’s very easy to install and even easier to use. I won’t get into the… Read more »

UITableViewController and NSFetchedResultsController

NSFetchedResultsController takes a lot of the work out of managing the display of data returned from a Core Data fetch request. The basic mechanism is to create a fetch request detailing what you are looking for, how to filter it, and how to order the results. This is then attached to a new NSFetchedResultsController, which queries… Read more »

Magical Record and NSFetchedResultsController: Core Data made easy

I was pretty happy after building my first iOS app that made extensive use of the Core Data framework. However, in the back of my mind I was sure there was a better way than the ton of code it required. Thankfully there is. Magical Record makes it so simple that it barely feels like Core… Read more »