GithubHelp home page GithubHelp logo

mozhouqi / kmnavigationbartransition Goto Github PK

View Code? Open in Web Editor NEW
3.4K 63.0 454.0 3.9 MB

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

License: MIT License

Swift 22.18% Ruby 2.99% Objective-C 74.84%
kmnavigationbartransition navigationbar transition transition-animations navigationbar-transition

kmnavigationbartransition's People

Contributors

csr avatar flexme avatar jaybowang avatar liaoworking avatar m1entus avatar mozhouqi avatar shengyangyu avatar tinpont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kmnavigationbartransition's Issues

页面间NavigationBar透明与不透明之间切换的BUG

iOS 10.0.1
我创建了三个ViewController,第一个不透明 第二个透明 第三个不透明
viewController1 -》 viewController2 -》 viewController3(此时ViewController2的navigation bar只显示44像素的颜色)
然后返回顺序
viewController3 -》viewController2 -》viewController1(此时ViewController1也只显示44像素)

With added child view controller, animation can be broken

After adding child view controller navigation bar animation can be broken when switching from transparent bar to untransparent, and looks like this:
withchildcontroller

But expected this:
withoutchildviewcontroller

The easiest way to replicate it add following code to your example:

   override func viewWillAppear(animated: Bool) {
      super.viewWillAppear(animated)
      navigationController?.setNavigationBarHidden(currentNavigationBarData.prefersHidden, animated: animated)

      dispatch_async(dispatch_get_main_queue()) {
         let child = UIViewController()
         child.view.hidden = true
         child.view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
         child.view.frame = self.view.bounds
         self.view.addSubview(child.view)
         self.addChildViewController(child)
      }
   }

Pushing a view controller too soon after launch adds an extra UINavigationBar to the underlying view controller

I'm opening my app from a push notification and immediately pushing a table view controller onto a navigation controller embedded in a tab bar controller right after launch. Doing so adds an extra navigation bar (it looks to be a copy of my own navigation bar) onto the underlying view controller's view, which also is a table view. Tabbing to another tab then tabbing back will get rid of the navigation bar. I am unable to provide screenshots or recordings publicly but if you need to see what i mean, please message me privately!

Edit: for now I've wrote some code to iterate through all the table view's subviews and remove UINavigationBar instances. It's a workaround but it seems to work. Would still love to see a solution to this!

这个库和SDAutoLayout、MJRefresh有冲突吗?

不知道是什么原因,用这个库后好多页面,布局位置有问题。
比如UIWebView用sdautolayout库布局然后再加上下拉刷新。
self.webView.sd_layout .spaceToSuperView(UIEdgeInsetsMake(0, 0, 0, 0));

我在webview加载完成时调用
[self.webView.scrollView setContentOffset:CGPointMake(0, 0) animated:NO];
内容会在屏幕顶端(状态栏下方)

改成-64
[self.webView.scrollView setContentOffset:CGPointMake(0, -64) animated:NO];
这样就正常了。

还有其他一些页面也是出现类似问题,具体也不太好描述。

在StoryBoard里用autolayout方式布局也会不正常,
UIViewController里有个UIContainer包含了静态Cell 的 UITableView,
然后这个Tableview的上方也会空出一块区域。

Install without Cocoapods

Hi,

How can I install this into my existing Xcode project without using pods?

Looks great and really excited to use it!

Kind regards,
Max.

set backtilte = "" not working

    let backbtn = UIBarButtonItem(title: "", style: .Plain, target: self, action: #selector(self.backBtnClicked))
    self.navigationController?.navigationBar.topItem?.backBarButtonItem = backbtn

sometimes not work

为什么我在push里加了 设置控制器View.backgroundColor.. 导航栏设置颜色的方法都无效呢

qq20160419-0 2x

如图所示:
重载了navigationController 的 push方法
在里面设置了被push的控制器的颜色
// 设置控制器的View背景色
viewController.view.backgroundColor = kColor_ViewBg;
导致 - > 在被push控制器里 设置导航栏颜色 无效......
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor redColor]] forBarMetrics:UIBarMetricsDefault];

我不知道这两句是不是有些联系... 但是我注释掉上面那句代码 导航栏颜色设置又好使了..

Can't seem to get it to work with Objective-C Project

I dropped the KMNavigationBarTransition folder into my project, and am not having success pushing a UITableView with translucent UINavigationBar with blank background image and blank shadow image onto a previous UITableView with regular UINavigationBar.

My view hierarchy is: UITabBarController -> UINavigationController subclass -> UIViewController. I have set both the background image and the shadow image of the navigation bar to [UIImage new] in the second view's viewDidLoad:. However, for some reason the navigation bar is not going away. Do you have any suggestions I could try? Thanks.

在导航栏上面设置图片的问题

我给导航栏设置一个底图,每次页面push和pop页面的时候导航栏的图片都是一开始显示拉伸的图片再显示正常的图片,设置底图的方法为在appdelegate中设置[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navibg"] forBarMetrics:UIBarMetricsDefault];

控制器里面有键盘弹出时

控制器里面有键盘弹出时,push操作反应会变慢(这个应该是系统的正常反应),但是手势pop回来时,侧边会出现闪烁情况。测试环境xcode8.1,模拟器8.0-10.0

滑动切换的时候不起作用

我的页面刚进去的时候navigationBar是透明的我用

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = UIImage()

然后随着滚动到一定的位置就改变为显示

self.navigationController?.navigationBar.setBackgroundImage(nil, forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = nil

但是不起作用,我移除这个库就有作用了,我轻轻的滑动返回一点然后继续停在这个页面,又可以其作用了。不知道为啥。麻烦看下

Navigation bar transition is broken if inside UITabBarController with custom animation transition

Hello,

Please can you assist.

If UINavigationController inside UITabBarController with custom animation transition. Navigation bar transition is broken

   func tabBarController(tabBarController: UITabBarController, animationControllerForTransitionFromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
      return FadeAnimation()
   }
final class FadeAnimation: NSObject, UIViewControllerAnimatedTransitioning {

   func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
      let fromView: UIView = transitionContext.viewForKey(UITransitionContextFromViewKey)!
      let toView: UIView = transitionContext.viewForKey(UITransitionContextToViewKey)!

      transitionContext.containerView().addSubview(fromView)
      transitionContext.containerView().addSubview(toView)

      UIView.transitionFromView(fromView, toView: toView, duration: transitionDuration(transitionContext), options: .TransitionCrossDissolve) { finished in
         transitionContext.completeTransition(true)
      }
   }

   func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
      return 0.25
   }
}

Thanks!

I would commit a Bug

KMNavigationBarTransition is nice, but can be better.
When I push to a viewController in portrait, and then pop in landscape, the navigationBar image's frame do not change.
I guess that AutoLayout should be applied to it.

主页面滑动屏幕左边边缘会卡死

我们的应用里使用了您的库,在tabbar上的主页面,手动在左边缘滑动会出现程序卡死的问题,而且是必现的问题,请问下要怎么处理

bug

titleTextAttributes
tintColor

no reset

please add .

UINavigationBar tintColor support.

It's better to support navigationBar.tintColor.

In most cases the tint color changes along with the bar tint color.
A light tint color looks good with a dark bar tint color, but looks bad when push to a light-bar-tint-color view controller.
Really hope you could think about it.

I'm not familiar with method swizzling things. Maybe I can try it myself later.
Thanks so much. You're amazing!

用unwind Segue返回时,导航栏的转换延迟

即使前后导航栏没有任何变化,回去时还是要有一个变白再显示的过程。猜测原因可以能是返回前一个view controller时后面那个view controller仍然存在所导致的。虽然可以用delegate作为workaround,但能支持就更方便,或者readme里面说明这个limit。

布局发生错乱

navigationItem.hidesBackButton = true;
然后在第一页面显示navbar,第二页面显示时。改变不同改变statubar 颜色 会出现BUG

presentViewController 出一个NavigationController 会有些问题...

71296364-05da-4cd0-86d6-716bf529a4c7
c51810be-eae2-4ca7-82ce-f7bcbcb3a128
如上图所示

presentViewController 出导航控制器.. 导航控制器的RootViewController是 testViewController ,在testViewController的ViewDidLoad方法中 push到第二个控制器test2ViewController

效果如下图所示... 导航栏的背景色会闪现出来...在不导入框架的时候是正常的..不知道面对这样的需求 有什么办法弄好...
default

NavigationBar changes colour if UITableViewController contains a UISearchController

The issue is that the navigationBar changes colour if UITableViewController contains a UISearchController.

Here is the code I use in viewDidLoad:
` let searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.delegate = self
searchController.dimsBackgroundDuringPresentation = true
searchBar.searchBarStyle = .prominent
searchBar.sizeToFit()
self.tableView.tableHeaderView = searchBar

    self.searchController = searchController
    definesPresentationContext = true

`

The issue occurs when I click on the search bar, then I cancel it. The navigation bar colour is then white.

请问一下导入KMNavigationBarTransition,之后怎么全局修改返回按钮

问题是这样的,我自己想全局自定义navigationbar 的返回按钮

自己采用的方法是在自定义的navigationController 里面重写 push 的方法

但是导入KMNavigationBarTransition 之后,应该是swizzling掉push方法

然后自己对Method Swizzling 并不是很了解,所以想请问一下po主

我想全局修改返回按钮为自定义按钮改怎么做呢?

Use of Private APIs

Hey guys,

I've noticed that there is use of private APIs in the UIViewController category. Has anybody tried to push this to the AppStore and not getting rejected for this?

- (void)km_resizeTransitionNavigationBarFrame {
    if (!self.view.window) {
        return;
    }
    UIView *backgroundView = [self.navigationController.navigationBar valueForKey:@"_backgroundView"];
    CGRect rect = [backgroundView.superview convertRect:backgroundView.frame toView:self.view];
    self.km_transitionNavigationBar.frame = rect;
}

Thanks.

ContainerView is changing to white during tranistion

Hi, i presented view controller using blur effect on background, so i wanted to all view controllers have clearColor, during - (void)km_viewWillLayoutSubviews { you are setting containerView to background color and my presented controllers looks ugly, do you really need to set background color to white color?

iOS8下不能使用系统自带的右滑返回

你好,我的工程中导入了KMNavigationBarTransition之后在iOS9上使用可以右滑返回,但是iOS8的模拟器上不可以,去掉KMNavigationBarTransition之后在iOS8上就可以右滑返回了。

Animation Issues

KMNavigationBarTransition is amazing to manage the navigation bar styles and makes transition animations. but when i use push and (tabBarController) hidesBottomBarWhenPushed, navigation bar have a white line on the left.

导航栏颜色渐变问题

UITableView滚动获取alpha值,然后以一个颜色值来生成个图片设备UINaviagationBar背景色,当alpha值为1时,手滑滑动返回到一半,再放弃返回,会发现此界面ViewController的view向下偏了64

在同一个navigationController里面某些viewController的push和pop想采用普通的效果,怎么破?

我发现用了大神你的这个项目,所有的navigationcontroller中的ViewController的push和pop操作效果都是你这个项目中所呈现的transition效果。我想在同一个navigationcontroller的栈中某些页面还是沿用系统的transition效果(push和pop的时候),某些有特殊需求的页面采用你这个项目中的transition效果,需要怎么破呢?

[Feature Request] add ability to enable or disable transition

This is not a very common case. But it's good to let user control this transition affect or not.

I see the WeChat app has two type of navigation bar transition. The original navigation transition and the other one just like this project(WeChat -> Me -> Cards & Offers).

Should we add a switch for this transition?

侧滑取消然后再侧滑会出现导航栏乱的现象

主页开启隐藏导航栏点击next到下一个界面选择bar tint color到第三层界面,第三层界面侧滑返回中途取消,然后再侧滑返回到上一层界面,再回到主页,关闭隐藏导航栏,点击next,就必现这个bug了。系统版本10以下都有这个问题,10以上的没有

关于3D touch peek&pop的支持

请问这个库支持3D touch peek&pop么?

比如现在从一个viewControllerA 往viewControllerB push,viewControllerB 里viewDidLoad我设置了它要透明的navigationBar。现在普通(单点)的push一切正常,但是如果3Dtouch 来push进入的话viewControllerB并不会透明navigatonBar :(

发现UI上有点问题

用手势慢慢pop的时候,发现当前界面的左侧边除去导航栏的部分有阴影,但是导航栏左边界部分没有阴影

底部1像素的黑线

你好,请问能提供支持定制Navibar底部1像素的线条颜色、隐藏的api吗。因为内部是新new一个navibar,所以自定义的设定在场景切换时会不起效。

Use only in specific cases

I know it uses Method Swizzling, but there is no way to make it works only in specific cases?

For exemple, I have 2 occurrences in my app where the navigation bars are different, so your library is helping me a lot to achieve a nice transition between them.

But I would want to ensure that KMNavigationBarTransition only affects these two view controllers.

There is a way to do that?

Thank you!

FeedBack来啦,关于背景

设置了这个属性(navigationBar.backgroundColor)以后,会出Bug.
如图是我在 Demo 的 MainViewController 的 ViewDidLoad 加入以下代码的结果

 navigationController?.navigationBar.backgroundColor = UIColor.yellowColor()

img_0186

img_0187

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.