CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2017 |
Maintained by Scott_Mr.
一行代码设置状态栏样式和导航栏背景颜色、标题、按钮、透明度以及全屏pop手势支持。
iOS 8.0+
Xcode 8.0+
Cocoapods
podfile
里面添加pod 'STNavigationBar', '~> 版本号'
pod install
手动拖入
下载代码并将STNavigaionBar
文件夹拖入到项目中,导入头文件#import "STNavigationBar.h"
即可。
建议在AppDelegate里全局设置导航栏以及状态栏样式。
[UIColor st_setDefaultNavigationBarBarTintColor:STMainNavBarColor];
[UIColor st_setDefaultNavigationBarTintColor:STNaviBarTintColor];
[UIColor st_setDefaultNavigationBarTitleColor:STNaviBarTitleColor];
[UIColor st_setDefaultStatusBarStyle:UIStatusBarStyleLightContent];
// 设置导航栏两边按钮颜色
[self st_setNavigationBarTintColor:[UIColor whiteColor]];
// 设置导航栏标题颜色
[self st_setNavigationBarTitleColor:[UIColor blackColor]];
// 设置状态栏样式
[self st_setStatusBarStyle:UIStatusBarStyleDefault];
// 设置导航栏透明度
[self st_setNavigationBarBackgroundAlpha:0];
// 设置导航栏背景颜色
[self st_setNavigationBarTitleColor:[UIColor whiteColor]];
// YES:关闭手势/NO:开启手势
[self st_setInteractivePopDisabled:YES];
[self st_setInteractivePopMaxAllowedInitialDistanceToLeftEdge:30.0];
// 自定义一个UIScrollView,实现如下方法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if (self.contentOffset.x <= 0) {
if ([otherGestureRecognizer.delegate isKindOfClass:[STFullscreenPopGestureRecognizerDelegate class]]) {
return YES;
}
}
return NO;
}
STNavigationBar 是基于 MIT 许可证下发布的,详情请参见 LICENSE。