Latest 1.1.1
Homepage https://github.com/BrentleyJones/NBJNibBasedView-ObjC
License MIT
Platforms ios 6.0, osx 10.8
Authors

Easy Nib based custom views

NBJNibBasedView is an easy way to use Nibs for custom views and controls. By conforming to the NBJNibBasedView protocol your view automatically loads its view hierarchy from the desired Nib, regardless of if you instantiated your view in code or in Interface Builder.

When used with NBJMergeLayout the resulting view doesn’t have an unnecessary extra shim view in the view hierarchy.

How it works

Along with the NBJNibBasedView protocol there is the UIView (NBJNibBasedView) category. This category uses method swizzling on the initWithFrame: and initWithCoder: methods of UIView to load the desired Nib and add its first object (which should be a view) to the view hierarchy.

Customization

To customize how the view hierarchy is loaded implement any of the following NBJNibBasedView protocol methods:

  • + (BOOL)nibBasedSubviewTranslatesAutoresizingMaskIntoConstraints
    • Defaults to NO
  • + (NSString *)nibBasedViewNibName
    • Defaults to the name of the class (so CustomView would load CustomView.xib)
  • + (NSBundle *)nibBasedViewBundle
    • Defaults to [NSBundle bundleForClass:[self class]]

Latest podspec

{
    "name": "NBJNibBasedView-ObjC",
    "version": "1.1.1",
    "summary": "Easy Nib based custom views",
    "homepage": "https://github.com/BrentleyJones/NBJNibBasedView-ObjC",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Brentley Jones": "[email protected]"
    },
    "social_media_url": "http://twitter.com/BrentleyJones",
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    },
    "source": {
        "git": "https://github.com/BrentleyJones/NBJNibBasedView-ObjC.git",
        "tag": "1.1.1"
    },
    "source_files": "NBJNibBasedView/**/*.{h,m}",
    "requires_arc": false
}

Pin It on Pinterest

Share This