Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ 常见问题 #18

Closed
l1Dan opened this issue Apr 22, 2023 · 4 comments
Closed

FAQ 常见问题 #18

l1Dan opened this issue Apr 22, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@l1Dan
Copy link
Owner

l1Dan commented Apr 22, 2023

Q:iOS14 及之后的版本为什么注册了 UIImagePickerControllerPHPickerViewController 类之后还是无法修改导航栏的外观?

A:因为 UIImagePickerControllerPHPickerViewController 里面的 UINavigationBar 是隐藏的,NXNavigationBar 会跟随系统导航栏隐藏与显示,所以无法修改(iOS14 之前系统的 UIImagePickerController 是可以修改的)。另外 PHPickerViewController 其实是一个 UIViewController 的子类,你既可以用 push 的方式显示控制器也可以用 present 的方式显示控制器,他们有个共同特点:使用的都是一个 “假” 的导航栏。


Q:为什么 iOS13 之前使用 self.navigationItem.searchController 设置的 UISearchBar 无法跟随导航栏的变化而变化,iOS13 之后的却可以呢?

A:因为在 iOS13 之前导航栏中不包含 UISearchBar,iOS13 之后导航栏才包含 UISearchBar 的。具体使用请参考示例代码


Q:如何解决 UIScrollViewUIPageViewController 全屏手势冲突?

A:使用 UIScrollViewUIPageViewController 全屏手势冲突解决方案。


Q:为什么 NXNavigationExtension 框架不包含控制器的转场动画功能?

A:原则就是尽可能的保持框架的简单轻量,将更多的精力花在框架本身的稳定性上,尽可能地使用系统原有功能。转场动画功能并不适用于所有业务场景,另外也不属于这个框架的功能。如果有转场动画的需求需要开发者自己实现,也可以参考VCTransitionsLibrary,或者参考示例代码


Q:为什么导航栏的系统返回按钮箭头和自定义返回按钮箭头的位置不一致?

A:因为导航栏的系统返回按钮是用 self.navigationItem.backBarButtonItem 属性来设置的。而自定义返回按钮是用 self.navigationItem.leftBarButtonItem 属性来设置的,他们的位置本来就不一样。当然你可以使用系统返回按钮,通过 (nx_)useSystemBackButton 属性设置是否使用系统返回按钮,再配合 (nx_)systemBackButtonTitle 属性设置系统返回按钮的标题。还可以通过 (nx_)backImageInsets 或者 (nx_)landscapeBackImageInsets 属性来控制自定义返回按钮图片的偏移量。

  • 返回按钮箭头在切图里尽量靠左而不要居中,右边可以保留透明背景。
  • 使用 nx_backButtonCustomView 属性自定义返回按钮时就需要开发者自己来修正箭头的偏移量了。
@l1Dan l1Dan added the documentation Improvements or additions to documentation label Apr 22, 2023
@l1Dan l1Dan pinned this issue Apr 22, 2023
@l1Dan l1Dan unpinned this issue Apr 22, 2023
@l1Dan l1Dan pinned this issue Apr 22, 2023
@l1Dan l1Dan closed this as completed Apr 22, 2023
@Q-DooD-Q
Copy link

swift UI 监听导航栏返回事件, 不起作用

@l1Dan
Copy link
Owner Author

l1Dan commented Aug 23, 2023

我试了下,可以监听返回事件,你看下 Demo 里面的代码,应该也是没问题的,关键代码如下:

        .useNXNavigationView(onWillPopViewController: { type in
            return false // true 可以返回,false 不能返回
        })

@Q-DooD-Q
Copy link

已解决,感谢

@l1Dan
Copy link
Owner Author

l1Dan commented Aug 23, 2023

已解决,感谢

后面还有问题的话可以新开一个issue哈,这个关闭的问题底下评论容易被忽略。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants