-
Notifications
You must be signed in to change notification settings - Fork 0
Creating a new FCat Project
The first thing to do is to fire up XCode and in the menu choose : "File" -> "New Project". Then select "IOS" -> "Application" -> "Empty Application".

Click next, name it, and add core data if you need it.

Download the github project and extract it. Then add it to your XCode project by drag and dropping the source code repository (make sure the "Copy items into destination group's folder" checkbox is checked):

The last steps are to create the config file and start the framework. First add an xml file to your project:

and set the configuration of your project, for example :
<cat-application>
<group name="first_tab_item">
<view class="WelcomeView" name="welcome" title="Welcome View" />
</group>
</cat-application>
In this example we create a very basic application that contains only one view called welcome, an instance of the WelcomeView controller. The title attribute defines the title of the view in the navigation controller.
So let's create a class called WelcomeView that inherits from a UIViewController, with an associated xib file, for example :

Finally we need to hook our application delegate to the framework. So open your AppDelegate.m file, and add the following import : #import "FCat.h" then change your – application:didFinishLaunchingWithOptions: method so it look like this :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [ [ [UIWindow alloc] initWithFrame:[ [UIScreen mainScreen] bounds]] autorelease];
self.window.backgroundColor = [UIColor whiteColor];
[[FCat get] startWithFile:@"fcat_cfg" andWindow:self.window];
return YES;
}
The FCat object is a singleton accessible from anywhere in your application as long as you import FCat.h. To start display your application call the - startWithFile:andWindow: method, with the name of your configuration file (note that we don't write the .xml extension of the file) and your UIWindow object.
Lastly allow FCat to shut down with your application by adding a call to your - applicationWillTerminate: function :
[[FCat get] stop];
Click run, et voila!
