Latest 1.1
Homepage https://github.com/inloop/INLBreadcrumbs
License CC0 1.0
Platforms ios 8.0
Authors

1. Overview

The INLBreadcrumbs library adds breadcrumbs to a UINavigationController. You can pop to an arbitrary view controller from the title view.

RVBreadcrumbs iPhone screenshot RVBreadcrumbs iPad screenshot

2. How to use

There are two ways breadcrumbs can be added to your application:

1: Subclassing INLBreadcrumbViewController

This is the simpler approach. All you need to do is subclass the INLBreadcrumbViewController. No further configuration needed.

#import "INLBreadcrumbs.h"

@interface MyViewController : INLBreadcrumbViewController

Congratulations. You have just added breadcrumbs to your application

2: Implementing the INLBreadcrumbCompatibleController protocol

This approach requires you to write slightly more code but it’s more flexible since you don’t need to subclass anything.

First, implement the INLBreadcrumbCompatibleController protocol and create a breadcrumb property of type INLBreadcrumb*

#import "INLBreadcrumb.h"

@interface INLBreadcrumbViewController : UIViewController <INLBreadcrumbCompatibleController>
@property (strong, nonatomic) INLBreadcrumb * breadcrumb;

In the +load method call the setupBreadcrumbs and in the -viewDidLoad initialise the breadcrumb property

#import "INLBreadcrumb.h"

@implementation INLBreadcrumbViewController

+(void)load {
    [super load];
    [self setupBreadcrumbs];
}

-(void)viewDidLoad {
    [super viewDidLoad];
    self.breadcrumb = [INLBreadcrumb breadcrumbWithController:self];
}

3. Multiple breadcrumb stacks

You can have multiple breadcrumb stacks e.g. if you have several UITabViewController tabs or a modal transition – each should have a separate breadcrumb stack. You associate a breadcrumb with a breadcrumb stack by setting the manager property before didMoveToParentViewController: is called.

-(void)viewDidLoad {
    [super viewDidLoad];

    // If subclassing INLBreadcrumbViewController
    self.breadcrumb.manager = [INLBreadcrumbManager managerForKey:@"stackId"]

    // If conforming to INLBreadcrumbCompatibleController
    self.breadcrumb = [INLBreadcrumb breadcrumbWithController:self
                                                      manager:[INLBreadcrumbManager managerForKey:@"stackId"]];
}

If you don’t specify a manager the default manager is used.

4. Customising the UI

You can change the breadcrumb indicator in the navigation bar title view (default is " ▾") and the cancel button title for the iPhone action sheet popup (default is “Cancel”) by setting the corresponding properties.

self.breadcrumb.cancelButtonTitle = NSLocalizedString(@"breadcrumbs.cancel”, nil);
self.breadcrumb.breadcrumbIndicator = @" 🍞";

This will only set the values for a specific breadcrumb. If you want to set it for an entire breadcrumb stack you can change the manager settings.

[INLBreadcrumbManager defaultManager].cancelButtonTitle = NSLocalizedString(@"breadcrumbs.cancel", nil);
[INLBreadcrumbManager defaultManager].breadcrumbIndicator = @" 🍞";

Changing the manager settings will not affect breadcrumbs that were already created. You should therefore set this before initialising the first view controller that uses breadcrumbs.

Latest podspec

{
    "name": "INLBreadcrumbs",
    "version": "1.1",
    "summary": "INLBreadcrumbs adds breadcrumbs to a UINavigationController",
    "description": "Adds breadcrumb navigation to a UINavigationController and enables pop to an arbitrary View Controller from the title view",
    "homepage": "https://github.com/inloop/INLBreadcrumbs",
    "screenshots": [
        "https://raw.githubusercontent.com/inloop/INLBreadcrumbs/master/Demo/Screenshots/INLBreadcrumbs-iPhone.png",
        "https://raw.githubusercontent.com/inloop/INLBreadcrumbs/master/Demo/Screenshots/INLBreadcrumbs-iPad.png"
    ],
    "license": {
        "type": "CC0 1.0",
        "file": "LICENSE"
    },
    "authors": {
        "Tomas Hakel": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/inloop/INLBreadcrumbs.git",
        "tag": "1.1"
    },
    "source_files": [
        "INLBreadcrumbs",
        "INLBreadcrumbs/**/*.{h,m}"
    ],
    "resources": "INLBreadcrumbs/INLNavbarTitleView.xib"
}

Pin It on Pinterest

Share This