Questions tagged [navigationbaritems]

20 questions
7
votes
2 answers

How can I add a badge to a leading navigationBarItems in SwiftUI and iOS 14?

How can I add a badge to navigationBarItems in SwiftUI and iOS 14? I cannot find anything on the net... I want for example add a badge over the leading navigationBarItems: var body: some View { NavigationView { ZStack { …
Flincorp
  • 751
  • 9
  • 22
5
votes
1 answer

How to fix the list strange padding when using navigationbaritems in swiftui since iOS 14?

Since iOS 14 i have a strange behavior where i have a padding around a list in a NavigationView as soon as i add navigationBarItems... My code : import SwiftUI struct TestList: View { var body: some View { NavigationView{ List { …
Flincorp
  • 751
  • 9
  • 22
4
votes
2 answers

SwiftUI align navigationBarItems buttons with large navigationBarTitle like in "Messages"

I am creating a SwiftUI app and I am using NavigationView and a large title bar. However, I don't like that navigationBarItems buttons are not aligned with the large title bar (3rd picture) like in the Messages app (first and second picture). I…
leonboe1
  • 1,004
  • 9
  • 27
2
votes
1 answer

SwiftUI Navigation does not work as expected with 3 views when navigationLink to third view is embedded in a navigationBar button

I'm a novice Xcode/SwiftUI developer and have been stuck on the following problem related to navigation. In the following minimum, reproducible example, I want the user to be able to navigate backwards through the app view-by-view after reaching the…
ej5607
  • 309
  • 2
  • 12
2
votes
1 answer

SwiftUI: implementing ZStack inside of navigationBarItems shows navigationBarItems error

I'm trying to implement a ZStack inside of navigationBarItems to load a custom alert. Here is my implementation: var body: some View { VStack{ List(self.itemsStore.names){ item in Text("hello") } …
user2924482
  • 8,380
  • 23
  • 89
  • 173
2
votes
0 answers

NavigationBar Item doesn't appear anymore after screen rotation SwiftUI iOS 14

I have a simple pattern : a list view with a detail view. Both have navigation bar item. Problem: Only on the detail view when I rotate the screen to landscape, the navigation bar item disappears and will never appear anymore even If I rotate back.…
2
votes
0 answers

Custom Navigation Bar items inactive/not working in List Details view in SwiftUI

I am looking for some help with a disabled navigation bar item in a detailed view in SwiftUI. import SwiftUI struct ContentView: View { //2 dimentionary lists var twoDimensionArray = [[1,2,3,4,5], [10,20,30,40,50], [33,55,66,77,88]] …
1
vote
0 answers

remove indicator color from NavigationBarItem in BottomMenu android compose

As per our requirement I need to set the container color of the BototmNav with 60% opacity. Due to this, when any icon is selected, container colors is displayed as background to the selected icon in the active state. It looks very weird. I looked…
1
vote
1 answer

Combination of Searchable, NavigationLink and navigationBarItems break app

When you compile below code and enter "J" in the search field and then click one of the entries, the app crashes when showing the NavigationLink destination. Clicking on an entry without any active filter works fine. import SwiftUI import…
Max B
  • 193
  • 1
  • 15
1
vote
1 answer

Is there a way to animate navigationbaritems with withAnimation(...?

For some reason the SwiftUi withAnimation does not work in the navigationBarItems modifier. Is there a fix for that? I know the .animation modifier on the view that is animated works but this is not enough for more complex animations. I was…
NilsBerni
  • 83
  • 2
  • 13
1
vote
2 answers

Spacing between navigationBarItems

How can I separate two buttons located in .navigationBarItems so they appear in different corners of the screen like here: Here's the code I'm using: .navigationBarItems(leading: HStack { EditButton() Spacer() …
Philipp
  • 183
  • 1
  • 9
1
vote
2 answers

self.navigationItem.rightBarButtonItem = Button not working?

I have a bit of code bellow which creates an bar button item to then add to the navigation bar on the right side like many apps do. The problem I am having is that the button/image do not show up at all. How can I fix this? FYI: This code runs as a…
user12822558
1
vote
1 answer

Maintain navigation item button alignment in SwiftUI as second button is added & removed

I have a scenario where there will be one or two trailing buttons based upon some criteria. I would like to have it such that the buttons always align to trailing for visual consistency, but so far, they appear to center align, regardless of what I…
CodeBender
  • 35,668
  • 12
  • 125
  • 132
0
votes
0 answers

How do I show user that they have selected navigationItem.leftBarButtonItems in swift?

I have navigationBarItems and I'm trying to change background color of UIButton when user taps it. Here is my code of navigationBarItems: private func createNavigationBarItems() { let boldButton = UIButton(type: .custom) boldButton.frame =…
0
votes
0 answers

SwiftUI toolbar button item issue

I have a ToolbarItemGroup with a navigation link and a button. With the current setup when I hit "Add" it goes to the AddNewTripView just fine but when I hit the back button (to return to the list view) it goes back to the previous view and then…
OEZ
  • 55
  • 8
1
2