Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devxoul/uinavigationitem-margin
Margins for UINavigationItem
https://github.com/devxoul/uinavigationitem-margin
extension margin objective-c uinavigationitem
Last synced: 2 months ago
JSON representation
Margins for UINavigationItem
- Host: GitHub
- URL: https://github.com/devxoul/uinavigationitem-margin
- Owner: devxoul
- License: mit
- Created: 2015-01-26T09:41:26.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T09:10:01.000Z (about 7 years ago)
- Last Synced: 2024-10-14T13:49:47.008Z (3 months ago)
- Topics: extension, margin, objective-c, uinavigationitem
- Language: Objective-C
- Homepage:
- Size: 39.1 KB
- Stars: 158
- Watchers: 3
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
UINavigationItem+Margin
=======================[![Build Status](https://travis-ci.org/devxoul/UINavigationItem-Margin.svg?branch=master)](https://travis-ci.org/devxoul/UINavigationItem-Margin)
[![CocoaPods](http://img.shields.io/cocoapods/v/UINavigationItem+Margin.svg?style=flat)](http://cocoapods.org/?q=name%3AUINavigationItem%2BMargin%20author%3Adevxoul)Margin for UINavigationItem.
Setting Margins
---------------Just set `leftMargin` and `rightMargin` of your UINavigationItem.
```objc
navigationItem.leftMargin = 0;
navigationItem.rightMargin = 0;
```![zero](https://cloud.githubusercontent.com/assets/931655/5898748/e1d333a0-a595-11e4-85a3-9a492d1d38fc.png)
Wow, margin has disappeared.
Even you can do this:
```objc
navigationItem.leftMargin = 50;
navigationItem.rightMargin = 20;
```![ugly](https://cloud.githubusercontent.com/assets/931655/6410361/12d1c69e-beb2-11e4-9cf6-7f7d9469ef09.png)
Looks ugly but works.
System Margins
--------------Want to restore margins? Use `[UINavigationItem systemMargin]`.
```objc
navigationItem.leftMargin = [UINavigationItem systemMargin]; // 16 on iOS 7+
navigationItem.rightMargin = [UINavigationItem systemMargin];
```![system](https://cloud.githubusercontent.com/assets/931655/6410333/d42763d6-beb1-11e4-845e-34002d336034.png)
Installation
------------I recommend you to use [CocoaPods](http://cocoapods.org).
**Podfile**
```ruby
pod 'UINavigationItem+Margin'
```License
-------**UINavigationItem+Margin** is under MIT license. See the LICENSE file for more info.