Comments (6)
Which version are you using?
from eachnavigationbar.
My podlock file shows 1.15.0
from eachnavigationbar.
Can I have a look at your code?
from eachnavigationbar.
Sure.
Ignore the custom Colour.
, Fonts.
and Image.
. These are SwiftGen structs for UIColor
, UIFont
and UIImage
In my UINavigationController
subclass, I have
private func setupNavigationBar() {
self.navigation.configuration.isEnabled = true
self.navigation.configuration.titleTextAttributes = [
.foregroundColor: Colour.text
]
self.navigation.configuration.barTintColor = Colour.layer1
self.navigation.configuration.isTranslucent = false
self.navigation.configuration.isHidden = true
self.navigation.configuration.backItem = UINavigationController
.Configuration
.BackItem(style: .image(Image.back),
tintColor: Colour.text)
}
The homepage has
private fund setupNavigationBar() {
self.navigation.bar.isHidden = false
self.navigation.bar.prefersLargeTitles = false
self.navigation.item.largeTitleDisplayMode = .never
self.navigation.bar.additionalHeight = 20
// acts as a bit of a skirt to keep the label off the bottom of the nav bar
let navFooter = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 18))
navFooter.backgroundColor = Colour.layer1
self.navigation.bar.additionalView = navFooter
// title
let label = UILabel(frame: .zero)
label.text = "Explore"
label.font = Fonts.h2
self.navigation.item.leftBarButtonItem = UIBarButtonItem(customView: label)
// search button
let imageview = UIImageView()
imageview.image = Image.search.withRenderingMode(.alwaysTemplate)
imageview.tintColor = Colour.text
let searchButton = UIButton(type: .custom)
searchButton.addTarget(buttonTarget, action: buttonSelector, for: .touchUpInside)
searchButton.addSubview(imageview)
searchButton.accessibilityIdentifier = "nav_button"
// snapkit constraints
imageview.snp.makeConstraints { (make) in
make.width.height.equalTo(24)
make.left.right.equalToSuperview()
make.top.bottom.equalToSuperview().inset(10)
}
self.navigation.item.rightBarButtonItem = UIBarButtonItem(customView: searchButton)
}
Before the next view controller is pushed, I call
trendingViewController.navigationItem.title = "Trending"
then in viewDidLoad(animated:)
on that view controller, I call
self.navigation.bar.prefersLargeTitles = true
self.navigation.item.largeTitleDisplayMode = .always
Then, my UI tests goes something like this
let app = XCUIApplication()
// tap cell to get into view controller
// test element exists
app.navigationBars.buttons.element(boundBy: 0).tap() // <-- fails
Thanks
from eachnavigationbar.
navigation.bar.backBarButtonItem = .init(style: .image(image))
Try using it in trendingViewController
from eachnavigationbar.
Sadly not made any difference. Putting a breakpoint in my test, when I type into the console
po app.navigationBars.buttons
I get the following output
Find: Target Application 'com.my.app'
Output: {
Application, pid: 18209, label: 'App'
}
↪︎Find: Descendants matching type NavigationBar
Output: {
NavigationBar, {{0.0, 47.0}, {428.0, 96.0}}, identifier: 'Trending'
NavigationBar, {{0.0, 47.0}, {428.0, 96.0}}, identifier: 'Trending'
}
↪︎Find: Descendants matching type Button
Output: {
Button, {{0.0, 47.0}, {55.7, 44.0}}, label: 'Back'
Button, {{12.0, 47.0}, {36.0, 44.0}}
}
I'm sure you'll know better than me, but I think it a bit weird there are two buttons, one which says "Back". Either way, when doing either po app.navigationBars.buttons.element(boundBy: 0).isHittable
is false for both 0 and 1.
I'm not sure if that's helpful.
from eachnavigationbar.
Related Issues (20)
- 横竖屏下状态栏高度也不一样? HOT 1
- Demo 中点击next 会崩溃 HOT 1
- Does it work with UINavigation.appearance()?
- 代码出现大量报错信息 不知如何修改 HOT 7
- Xcode14 beta 编译报错 HOT 9
- 希望automaticallyAdjustsPosition可以全局配置
- Compiling for iOS 10.0, but module 'EachNavigationBar' has a minimum deployment target of iOS 11.0
- 横屏转回竖屏后,状态栏消失,导致整个bar上移重叠
- 隐藏状态栏后跳转到 next,bar与状态栏重叠
- 当UINavigationController套UINavigationController时,_UIBarBackground的高度会变高,各种相关的设置也会失效
- 未对ios16的导航栏做兼容。导致刚开启App的时候导航栏标题无法显示。
- 最新版本在模态弹出时候 导航栏高度低于系统原生导航栏高度
- iOS 16.3.1导航栏内容上移的问题
- storyboard创建常用的->NaVC->TabBarVC,头部title和底部itemTitle有问题。头部title无法设置
- 不支持添加系统的搜索框
- 怎么获取导航栏高度
- UINavigationBarAppearance issue on xcode 15.0 HOT 2
- 导航栏顶部没有紧贴屏幕顶端,大概有0.5像素的空隙 HOT 1
- Any Plan support Apple Privacy Manifest for cocoapods ? HOT 1
- 灵动岛上获取的导航栏高度出错 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eachnavigationbar.