Skip to content
This repository was archived by the owner on Jun 11, 2023. It is now read-only.

Creating a new FCat Project

fdelbos edited this page Nov 26, 2011 · 29 revisions

Setup a new FCat Project

Creating an "Empty 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".

Project creation

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

Project creation

Adding FCat to your project

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):

Project creation

Starting FCat

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

Project creation

and set the configuration of your project, for example :

<cat-application>
    <title>My Application</title>
    <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 is called My Application and contains only one view called welcome, that is 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 :

Project creation

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.

Test your project

Click run, et voila!

Project creation

Clone this wiki locally