ltebean / ltnavigationbar Goto Github PK
View Code? Open in Web Editor NEWUINavigationBar Category which allows you to change its appearance dynamically
License: MIT License
UINavigationBar Category which allows you to change its appearance dynamically
License: MIT License
在xcode 8.0上 导航栏失去了渐变色的效果,不知道是何缘故,xcode7.3正常
It seems it's my fault. Please close the issue. Sorry for the troubles.
如果导航栏设置了透明的话,iOS10上面导航栏完全是是白色的标题也看不清。
push to other Controller navigationBar color can not set to default
How is the compatibility to use this library in a Swift project?
I saw the code , when the version is less than 10.0, the overlay 's height is heighter 20 than before.
if (SYSTEM_VERSION_LESS_THAN(@"10.0")) { self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)]; } else { self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)]; }
把这个文件UINavigationBar+Awesome.h 里面的方法lt_setBackgroundColor 改成这样就解决了
- (void)lt_setBackgroundColor:(UIColor *)backgroundColor
{
if (!self.overlay) {
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
self.overlay.userInteractionEnabled = NO;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
}
[self insertSubview:self.overlay atIndex:0];
self.overlay.backgroundColor = backgroundColor;
}
因为返回回来之后self.overlay就跑最上面一层去了,并没有在最后面,所以就挡到了,显示不出来了
每次这样手动处理一下就好了
The LTNavigationBar was awesome.
How to remove the left side back button on the navigation.
Instead of transitioning to solid colors on scroll, can you add the functionality to transition to translucent colors? like UIBarStyleBlackTranslucent ?
From my test, seems like it can only do the first view controller.
急求...
Awesome code for a nice effect, thank you. I have one problem where the back button does not work any longer when I navigate down a few layers. Any idea what that could be? It might be my code.
iOS 10 系统下 重新赋予 navigationBar shadowImage ,返回时shadowImage无法立即消失
iOS 8、9系统没问题。
I try to fix this issue! I'll push request after I fix it!
Could you integrate a Parallax effect like in this lib:
https://github.com/JackTeam/PathCover
I think this would look great with your awesome lib.
I am writing code for app with future support so basically i'm looking at all side previous versions, current version, as well as future version which will be iOS 10.
This category works perfect until iOS 9.3.3 but in iOS 10 its not working, i've tested on both iDevice and Simulator
I'm setting clear colour for navigation bar at viewDidLoad
as below
[self.navigationController.navigationBar setShadowImage:[UIImage new]]; [self.navigationController.navigationBar lt_setBackgroundColor:[UIColor clearColor]];
Please someone help me out with this.
I'm sorry for my english, i don't know what language you're using 😜
Thanks.
If the navigation bar have a back button item it didn't change alpha value and is always displayed in statusbar
+
button on navigation barBack
button on navigation barI donot know why...
如题。
看demo只能是透明到蓝色或者自定义颜色的过度,有办法保留原始样式,并实现过度吗,能给个实现逻辑吗。
I have setted the tableView's delegate to nil in viewWillDisappear,but the reset is still not work
In Xcode8, size of any UIView loaded from xib has changed to be (1000, 1000). So if I load a single UINavigationBar(not from UINavigationController) from xib, its height will be 1020, the view of UIViewController will be covered by the overlay, which is added by LTNavigationBar.
Solution: Auto layout should be used, don't use "self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth;" Just like the following:
// self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth; // Comment out this line
self.overlay.translatesAutoresizingMaskIntoConstraints = NO;
[[self.subviews firstObject] insertSubview:self.overlay atIndex:0];
NSArray *hConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(0)-[overlay]-(0)-|" options:0 metrics:nil views:@{@"overlay":self.overlay}];
NSArray *vConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(-20)-[overlay]-(0)-|" options:0 metrics:nil views:@{@"overlay":self.overlay}];
[self.overlay.superview addConstraints:hConstraints];
[self.overlay.superview addConstraints:vConstraints];
'''
UINavigationBar *navigationBar = [UINavigationBar appearanceWhenContainedIn:[ABPeoplePickerNavigationController class], nil];
[navigationBar lt_setBackgroundColor:[UIColor colorWithHexString:@"#0065A1"]];
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentViewController:picker animated:YES completion:nil];
'''
the background color has no effect
The NavigationBar height gets about +20 pixels larger after update on all NavigationBars.
tableview滚动上去,navigationbar颜色显示出来之后,navigationBar自带的毛玻璃效果貌似就没了……是因为和已有效果冲突么?
我这样书写,但是提示我无法下载下来,pod 'LTNavigationBar', :git => 'https://github.com/ltebean/LTNavigationBar.git', :branch => 'swift3.0'
语法上是没有问题的,怎么不行呢,求解答。谢谢大神!
最新的demo中,从第一个标签页导航栏透明的情况下跳转到一共空白页面,滑动返回,空白页面的导航栏也是白的。
I would like the NavigationBar to use a gradient background layer when it is in the transparent state. Some images have very light colors which makes the navigation bar content elements nearly invisible.
What is the best way to do that?
The same error with wrong background size on device rotation.
On ios8 everything is ok, error is on ios7.
I have an issue since iOS 10, the fade animation I used for my scroll view also hide the menu icon and the navigation bar title.
When I navigate threw my App, the color that I used with lt_setBackgroundColor on my HomeViewController override all my navigation bar titles / menu icons, so they appear hidden.
If I call [self.navigationController.navigationBar lt_reset], I can clearly see them all but the color background is back to white.
The behaviour was working perfectly since xCode 8 / iOS 10, and is still working when I launch my App with an iPhone < iOS 10.
I would like to know what changed and how can I fix it?
LTNavigationBar[11369:4642197] [Accessibility] ****************** Loading GAX Client Bundle ****************
2017-06-28 14:30:40.795882+0800 LTNavigationBar[11369:4642197] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UINavigationBar 0x1039250a0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _leftViews.'
*** First throw call stack:
(0x186ed9858 0x1856b0528 0x186ed9520 0x187a26e88 0x18796ceac 0x10367efc0 0x10367e05c 0x10367de80 0x18d9e000c 0x19d4e7f00 0x18d705b5c 0x18d7ab6c0 0x18d871a0c 0x18dd49978 0x18dd4df1c 0x18d862b9c 0x18d7181f4 0x18dd38364 0x18dd37f24 0x18dd37080 0x18d7164f4 0x18d6e7b38 0x19d4af210 0x18dfe9514 0x18dfeb984 0x18dfe4af0 0x186e80528 0x186e7fe0c 0x186e7d904 0x186d9c280 0x1888adf94 0x18d74b0f0 0x10367ea80 0x185b8de40)
libc++abi.dylib: terminating with uncaught exception of type NSException
I tried to create your example in code instead of in the storyboard.
In AppDelegate I created:
let vc = Page1ViewController()
window?.rootViewController = UINavigationController(rootViewController: vc)
Page1ViewController is:
@objc(Page1ViewController)
class Page1ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let cellIndentifier = "cell"
let NAVBAR_CHANGE_POINT:CGFloat = 50
@IBOutlet weak var tableView: UITableView!
var topView:UIView!
var topImageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.setLeftBarButtonItem(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Cancel, target: self, action: "someAction"), animated: true)
self.tableView.delegate = self
self.tableView.dataSource = self
self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: cellIndentifier)
self.navigationController?.navigationBar.lt_setBackgroundColor(UIColor.clearColor())
topView = UIView(frame: CGRectMake(0, 0, 320, 212))
topView.backgroundColor = UIColor.yellowColor()
tableView.addSubview(topView)
let img = UIImage(named: "bg2")
topImageView = UIImageView(image: img)
topImageView?.frame = CGRectMake(0, -89, 320, 307)
topImageView?.contentMode = UIViewContentMode.ScaleToFill
topView.addSubview(topImageView!)
topView.superview?.sendSubviewToBack(topView)
}
...
}
In the nib of Page1ViewController
I just inserted a UITableView
and linked the outlet to tableView
.
Here is the result when I run the app:
It works like your demo app with the exception that the header does not have the correct height. How can I change that?
Thanks for help!
On rotation the background rectangle stays as in portrait.
When using the lt_setBackgroundColor
the color changes somewhat abruptly.
Ir would be awesome if the color could change in a smoother way with an animation.
我有一个方法会频繁调用
- (void)handlePopGesture:(UIPanGestureRecognizer *)popGesture
{
// 计算用户手指划了多远
CGFloat progress = [popGesture translationInView:self.view].x / (self.view.bounds.size.width * 1.0);
progress = MIN(1.0, MAX(0.0, progress));
YPLog(@"%f",progress);
CGFloat r = _endR - _startR;
CGFloat g = _endG - _startG;
CGFloat b = _endB - _startB;
UIColor *endColor = [UIColor colorWithRed:_startR + r * progress green:_startG + g * progress blue:_startB + b * progress alpha:1.0f];
[self.navigationController.navigationBar lt_setBackgroundColor:endColor];
}
随着进度改变Bar的背景颜色。。 发现不好用 颜色不会变
I used a single UINavigationBar(NOT UINavigationController), App crashed on lt_setBackgroundColor method. It seems that UINavigationBar subviews structure has changed.
push新的ViewController
在新的ViewController中viewWillAppear中
无法改变颜色
I forgot someThing. zzz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.