Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

zero3nna/UIBarButtonItem-DefaultBackButton

Repository files navigation

UIBarButtonItem-DefaultBackButton

Category to create iOS 7 UIBarButtonItem like the back button.

First make sure that you have init and updated the submodule from marius-.

Include this category in your *-Prefix.pch file:

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import "UINavigationItem+iOS7Spacing.h"
#endif

Then import the category in any class you want to use it:

#import "UIBarButtonItem+DefaultBackButton.h"

At last create the custom leftBarButtonItem and hide the backBarButtonItem:

self.navigationItem.hidesBackButton = NO;
self.navigationItem.leftBarButtonItem = [self.navigationItem.leftBarButtonItem backButtonWith:@"Mainmenu"
tintColor:[UIColor colorWithRed:1.0/255.0 green:136.0/255.0 blue:185.0/255.0 alpha:1.0]
andAction:@selector(backAction)];

The result:

alt text

Fully tested on iOS 6 & 7.

A german tutorial can be found under: FudgeCode.de