My question is how to implement this code (I'm going to put it in the buttonPress method)
Define the method as IBAction as -(IBAction)add:(id)sender , and in the interface builder, associate the touch up inside event with the touch up inside button of a dispatcher object of the form add:
Do I need to define something in my header file? The bit that bothers me is that apple on provides this file without a header, so I can't say if there should be something there?
Nope. UIKit.h needs all these needs UIKit.h Usually you need to change the header to add methods, add instance variables, or include custom classes. However, you may need #import RecipeAddViewController.h somewhere (in your header or implementation file) to use this class. This is true for any custom class that you write that you want to use in another file.
The code refers to the RecipieAddViewController, what can I add to this: "UIViewController"?
Replace this with the view controller class you want to click. UIViewController itself is rarely naked. This is for a subclass. Thus, you create a new class that inherits from the UIViewController , import its title, create an instance of it, and click on the navigation controller.
source share