GithubHelp home page GithubHelp logo

gallgall / sfemptybackbutton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fdzsergio/sfemptybackbutton

0.0 1.0 1.0 161 KB

Remove back title from UIViewControllers

License: MIT License

Ruby 13.81% Objective-C 54.81% Swift 30.72% Shell 0.66%

sfemptybackbutton's Introduction

SFEmptyBackButton

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.

sfemptybackbutton's People

Contributors

fdzsergio avatar gallgall avatar

Watchers

James Cloos avatar

Forkers

xivanapp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.