Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kealdishx/ZSNavigationBar
ZSNavigationBar uses category to allow you change UINavigationBar appearance dynamically.(supported iOS 11+ and iPhone X)
https://github.com/kealdishx/ZSNavigationBar
alpha background category ios objective-c swift uinavigationbar
Last synced: 24 days ago
JSON representation
ZSNavigationBar uses category to allow you change UINavigationBar appearance dynamically.(supported iOS 11+ and iPhone X)
- Host: GitHub
- URL: https://github.com/kealdishx/ZSNavigationBar
- Owner: kealdishx
- License: mit
- Created: 2018-07-27T07:02:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-28T08:02:07.000Z (over 6 years ago)
- Last Synced: 2025-01-13T12:14:51.542Z (26 days ago)
- Topics: alpha, background, category, ios, objective-c, swift, uinavigationbar
- Language: Swift
- Homepage:
- Size: 210 KB
- Stars: 110
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZSNavigationBar[中文说明](https://github.com/iiiCeBlink/ZSNavigationBar/blob/master/README_CN.md)
ZSNavigationBar uses category to allow you change UINavigationBar appearance dynamically.(supported iOS 11+)
## Installation
### CocoaPods
- **Swift:**
1. Add `pod 'ZSNavigationBar'` to your Podfile.
2. Run `pod install` or `pod update`.
3. Import `ZSNavigationBar`.- **Objective-c:**
1. Add `pod 'ZSNavigationBar-oc'` to your Podfile.
2. Run `pod install` or `pod update`.
3. Import `ZSNavigationBar`.### Manually
1. Add all files under `Source-oc` or `Source-swift` folder.
2. Link with required frameworks: `UIKit`.
3. If you use oc version, just import `UINavigationBar+custom.h`.## Requirements
- iOS 8+
- Xcode 9+
- swift 3.0+
- Objective-c## Usage
- **Swift:**
The category includes several methods that helps to change UINavigationBar's appearance dynamically:
```swift
func setCustomBackgroundColor(_ backgroundColor: UIColor)
func setCustomTranslationY(translationY: CGFloat)
func reset()
```And usually in `viewWillDisappear`, you should call this method to avoid any side effects:
```swift
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.navigationBar.reset()
}
```- **Objective-c:**
First, import this lib:
```Objectivec
#import "UINavigationBar+Custom.h"
```The category includes several methods that helps to change UINavigationBar's appearance dynamically
```Objectivec
- (void)zs_setBackgroundColor:(UIColor *)backgroundColor;
- (void)zs_setTranslationY:(CGFloat)translationY;
- (void)zs_reset;
```And usually in `viewWillDisappear`, you should call this method to avoid any side effects:
```Objectivec
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController.navigationBar zs_reset];
}
```## License
ZSNavigationBar is available under the MIT license. See the LICENSE file for more info.