Latest Articles

Use the navigation at the bottom to see older articles

How to “quick save” in Core Data

The easiest way to access a readily available save method is by importing AppDelegate into the class that wants to execute the save. Then we call a method in AppDelegate: AppDelegate *myAppDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate]; [myAppDelegate saveContext]; No reference to fetchedResultsController or managedObjectContext or any complex &error statements.

How to define a Protocol

Protocols are a great way to delegate responsibility from one class to another. Consider a view controller that brings up another view controller via a modal segue. Let’s call them ViewController and DetailViewController. When it comes to dismissing that DetailViewController, he could do it himself via [self dismissViewControllerAnimated:YES completion:nil]; However, the first ViewController wouldn’t be […]

How to dequeue UITableViewCells

Sometimes Xcode does a bit of magic behind the scenes which I don’t really understand. Consider this standard table view method to display cells: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@”Cell”]; // populate your cell return cell; } Where do we actually ever create a UITableViewCell? All we’re asking here […]

How to hide (and show) the UISearchBar in a UITableView

If you add a UISearchBar to your table view (see previous article) it’s just sitting there by default. Chances are you’d like to hide it when your table view first loads. You can do this by adding the following code to your viewWillAppear method: – (void)viewWillAppear:(BOOL)animated { // scroll the search bar off-screen CGRect newBounds […]

How to create a searchable UITableView

The ingredients for a search function in a UITableView are more involved than just displaying a simple search field. First we need the standard UITableView. Next we need a UISearchBar which can be added to the top of the table view. But displaying the actual search results is something called the UISearchDisplayController. This process isn’t […]

How to restore WordPress to a different domain

In this podcast I will show you how to restore a WordPress site that we’ve backed up in the previous show. In particular, we will restore a remote website to our local system first, and because it’s a rather tricky process we’ll also install it on another remote host. For both examples the domain will … Read more

How to fix “this class is not key value coding-compliant” after accidentally adding an IBOutlet instead of an IBAction

It has happened to us all: you’re in a storyboard, you’re using the Assistant Editor, you want to control-drag from a button into your code and create an action. But sadly you forget to select “Action” from the drop down menu and instead create an outlet. No biggie you think, deleting the outlet code. You […]

How to convert an NSString into an integer

Imagine you had an NSString and wanted to save it as an integer value. You can use the intValue method for that: NSString *myString = @”47″; int myInt = [myString intValue]; To do the reverse, you can use the initWithFormat method: int myInt = 32; NSString *myOtherString = [[NSString alloc]initWithFormat:@”%i”, myInt];