Latest 2.1.0
Homepage https://github.com/fdzsergio/SFEmptyBackButton
License MIT
Platforms ios 8.0, requires ARC
Dependencies Aspects
Frameworks UIKit
Authors

Build Status
Carthage compatible
codecov.io
Version
License
Platform

Usage

To remove the title back button is only necessary to invoke:

// Magic happens here
[SFEmptyBackButton removeTitleFromAllViewControllers];

If you only want to delete the title in certain views invokes this:

[SFEmptyBackButton removeTitleFromViewControllers:@[YourViewController.class, AnotherViewController.class];

How It Works

When you have a view with a very long title like this:

The Problem

And navigate to another view with a very long title the following occurs:

The Problem

If you delete the title back button invoking:

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-100, 0) forBarMetrics:UIBarMetricsDefault];

Most likely this will happen:

The Problem

But if you rewrite back button with empty title in all views:

UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];

[self.navigationItem setBackBarButtonItem:backButtonItem];

You get the desired effect:

The Problem

Installation

CocoaPods

SFEmptyBackButton is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SFEmptyBackButton"

Carthage

You can also install it via Carthage. To do so, add the following to your Cartfile:

github "fdzsergio/SFEmptyBackButton"

Author

Sergio Fern├índez, [email protected]

Acknowledgement

This CocoaPod has been made possible thanks to Aspects by @steipete

License

SFEmptyBackButton is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SFEmptyBackButton",
    "version": "2.1.0",
    "summary": "Remove back title from UIViewControllers.",
    "description": "Useful library to remove text from back button andnalign the title in the center of UIViewController.",
    "homepage": "https://github.com/fdzsergio/SFEmptyBackButton",
    "screenshots": [
        "https://raw.githubusercontent.com/fdzsergio/SFEmptyBackButton/master/Screenshots/1.png",
        "https://raw.githubusercontent.com/fdzsergio/SFEmptyBackButton/master/Screenshots/2.png",
        "https://raw.githubusercontent.com/fdzsergio/SFEmptyBackButton/master/Screenshots/3.png",
        "https://raw.githubusercontent.com/fdzsergio/SFEmptyBackButton/master/Screenshots/4.png"
    ],
    "license": "MIT",
    "authors": {
        "Sergio Fernu00e1ndez": "[email protected]"
    },
    "source": {
        "git": "https://github.com/fdzsergio/SFEmptyBackButton.git",
        "tag": "2.1.0"
    },
    "social_media_url": "https://twitter.com/fdzsergio",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Source/*",
    "frameworks": "UIKit",
    "dependencies": {
        "Aspects": [
            "~> 1.4"
        ]
    }
}

Pin It on Pinterest

Share This