Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Set of tools and utilities (command line, GUI, Mac Service) to transform NIB files for the iPhone into Objective-C code files

tag: 0.3

Fetching latest commit…

Cannot retrieve the latest commit at this time


nib2objc – NIB to Objective-C converter

This utility converts NIB files (or XIB ones) into Objective-C code, including all the properties of each instance, the documented constructor calls, and also the view hierarchy. It uses the output of the ibtool utility bundled with the Xcode tools. For more information about ibtool, please check the ibtool man page.


Compile and put the utility in your path, and then call

nib2objc yourfile.xib > code.m

This will generate a file with the output of the conversion, similar to this (check out the included sample.m file for the full version):

    // ...
    UIButton *view9 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    view9.frame = CGRectMake(167.0, 65.0, 72.0, 37.0);
    view9.tag = 0;
    view9.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    view9.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.000];
    view9.enabled = YES;
    view9.clearsContextBeforeDrawing = NO;
    // ...
    view9.contentMode = UIViewContentModeScaleToFill;
    view9.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
    view9.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    // ...
    [view9 setTitle:@"Test" forState:UIControlStateNormal];
    [view9 setTitleColor:[UIColor colorWithRed:0.196 green:0.310 blue:0.522 alpha:1.000] forState:UIControlStateNormal];
    [view9 setTitle:@"Test" forState:UIControlStateSelected];
    [view9 setTitleShadowColor:[UIColor colorWithWhite:0.000 alpha:1.000] forState:UIControlStateNormal];
    [view9 setTitleColor:[UIColor colorWithWhite:0.000 alpha:1.000] forState:UIControlStateDisabled];

    [view6 addSubview:view8];
    [view6 addSubview:view10];
    [view6 addSubview:view11];

    // ...

The generated code takes into account the real class hierarchies in the UIKit, and it outputs the correct constructors and/or method calls for each object, depending on its class, including the enum values corresponding to the properties using them.


  • For the moment this utility only works for UIKit views (iPhone), but it should be easy to extend to those of the AppKit too.
  • It cannot output the values of UIImage properties, because ibtool does not support this.
  • It does not distinguishes default values for properties, and as such, it outputs all the information it can find about a particular instance.
Something went wrong with that request. Please try again.