NBUKit Customization

Ernesto Rivera edited this page May 7, 2013 · 5 revisions
Clone this wiki locally

For versions 1.5.0 and up

There are several ways to customize NBUKit modules for your needs. From easiest to more advanced:

1. NBUKit.strings

All strings in NBUKit are localized with unique table keys making it easy to modify them for your project your project.

By default the default localization tables for english and japanese are saved to NBUKit.strings files inside the NBUKitResources.bundle's en.lproj and jp.lproj folders.

If you want to add another language or just change some localization values simply:

  1. Make a copy of any of the NBUKit.strings files to your project.
  2. Add the new file to your targets' Copy Bundle Resources.
  3. Edit the values you want to modify. You can also remove entries from the values you don't want to modify.
  4. Optionally localize your NBUKit.strings copy add support for more languages to NBUKit.

Customize strings

How localized strings are loaded

To load a string NBUKit will look for entries in the following places and stop once a value is found:

  1. Localized NBUKit.strings for the device language in your app's bundle (e.g. MyApp.app/es.lproj/NBUKit.strings).
  2. Non-localized NBUKit.strings in your app's bundle (e.g. MyApp.app/NBUKit.strings).
  3. Fallback to default values inside NBUKitResources.bundle.

2. Nib files

You can modify the look and feel of NBUKit modules without even writing code by editing Nib (Xib) files. For instance you can move views, adjust sizes and colors or simply remove elements that your App doesn't need.


Very similar to strings' handling you can override Nib files that NBUKit loads:

  1. Make a copy of the Nib file you want to customize (e.g. NBUBadgeView.nib).
  2. Add the new file to your targets' Copy Bundle Resources.
  3. Edit the Nib, change the background images, colors, sizes and outlet connections.

Now your Nib copies will take precedence over the default NBUKit Nibs.

Customize Nibs

Customize Nibs

Specify your own Nib file

Most NBUKit classes allow you to specify the nibName to be used to load a view or populate a thumbnails grid.

- (void)viewDidLoad
    [super viewDidLoad];
    // Configure the grid view
    self.gridView.margin = CGSizeMake(5.0, 5.0);
    self.gridView.nibNameForViews = @"CustomAssetThumbnailView";

For view controllers just set the Nib to load in IB:

Customize Nibs

3. Subclass

When needed just subclass NBUKit classes. If you need more flexibility post and issue or a pull request.