SwiftUI - Navigation View opening with Back button and half grey screen / weird behavior - swift

I am trying to add navigation view to my app, but it is causing issues. My main UI is an infinitely swipe-able carousel of pages. It originally looks like this:
Then when I wrap it in a navigation view, it opens like this, with a back button and nothing else:
When I hit the back button, it looks like this:
The left side is swipe-able like the original UI, but when I touch the right, grey side, it takes me back to the empty page with the back button.
Any idea what may be causing this? I implemented the infinite carousel by putting each page in a ZStack, and using offsets/relativeLocation. I referred to this tutorial:
https://www.youtube.com/watch?v=fB5MzDD1PZI
Can I not use a NavigationView? Is there an alternative route I can take in which I create my own top NavBar and navigate to separate views without NavigationBar/NavigationLink?
Any help is appreciated and please feel free to ask questions, etc. Thanks!

You want to apply StackNavigationViewStyle to your NavigationView.
NavigationView {
...
}.navigationViewStyle(StackNavigationViewStyle())
You're experiencing an unwanted split view, and you can find more info here.
For larger devices like an iPad or iPhone Pro Max in landscape, it defaults to DoubleColumnNavigationViewStyle.

Related

Can't move focus from table view to adjoining button on tvOS

I have a single ViewController which contains a Table View on the left and a few labels on the right. Navigating through the table view entries works fine (up/down). Focus is no problem there. Even the related text in the labels is updated just fine using tableView:didUpdateFocusInContext.
The interface looks like this:
However, the button on the right ("Jetzt ansehen") never gets focus. When I use the debugger (as suggested in the official documentation), it doesn't include the button in the focusable area at all:
I really tried to solve this using UIFocusGuide, but I have no real idea how to accomplish that, yet.

Modal/menu sliding in from the top

I'd like to create a menu sliding from the top with a list of options.
More specifically, when the user clicks the navigation bar, I would like that a kind of modal view will slide from the status bar to the bottom. The modal will be a tableview.
I'd like something similar to the app Foursquare where (in the explore tab)
if you click the navigation bar a menu, sliding from above, will appear like this:
How can I build such a modal/menu?
Check out DDSlidingPanels on github. There is an example project to help you get started. Is iOS 6+ because it uses nested view controllers and autolayout.
DDSlidingPanels
I like it because:
It is customizable (pull-out tab, position left, right, top, bottom, size of pull-out, supports dragging gestures for pulling down, pushing back, etc.).
It is easy to implement in your own project (the example project is helpful).
I have used it in one of my projects successfully and customized it quite a bit. I don't have any affiliation with the author.

scrollview with page control reset

Okay, I have a Scroll View with Page Control that works properly between 2 sections (2 pages).
So I can scroll left and right once. Is it possible to always scroll right?
Like when you get to page 2, it expands to the right, but not allowing to scroll back left.
I dont need it to simply add another page and have 3 pages then 4. at all times there should be only 2.
The reason I need this function is because I will use the scrolling to reset data. As you scroll to the right a duplicate of the interface with cleared fields will come on to the screen as the interface with the old data will go off. Its a neat way to reset, not just a boring old button.
Can someone point me in the right direction on how to do this?
There are many examples of this. Here are a couple.
InifiniteHorizontalScroll
StreetScroller
Hope this helps.

iPhone using voiceover moves off screen, cannot press button

I have run into a baffling behavior using VoiceOver. Basically when using the "swipe forward" gesture on a screen, the cursor will run off the bottom of the screen and the view will not "move" with it as it should. Worse of all, I have a button down there that is not activated by a double tap when this behavior exists.
What I can gather is that this only seems to happen on two screens, both of which feature customized appearances of the cells in a table view.
I have tried manipulating the accessibilityFrame property of these cells and these table views. I have gotten nowhere. I have tried setting the accessibilityFrame property of the cells as they are made but there was no change in behavior.
Has anyone encountered this behavior? Any ideas for trying to tackle this problem?
I've seen it, but it's not a problem, at least not in my app -- you can double-tap anywhere, not just on the button. (In other words, a blind user won't realize this is going on, because it just works.)

Wizard style of interface in iPhone

How would one implement a wizard style interface for the iPhone?
For instance I have a form that I would like to break down into 5
different pages or views instead of putting all the information to fill out
into one page or view.
This interface must have the ability to go prev or next in case they want
to change something on page 2 when they are on page 4.
This interface must have the ability to go to page 3 directly and still be
able to go prev and next. Seems like using UINavigationController wouldn't
work here since views 1 and 2 are not on the stack so prev would not work.
Update: Check out the "gas cubby" application. It has what I'm looking for. UITableView presents the items you can fill out. Selecting a row takes you to the detail view to enter data and prev and next to fill in other information.
UINavigationController seems like the obvious solution. It gives you nice, familiar page transitions for free, and if you need to jump to a specific page you can just set up your navigation stack without using the transition animations.
I would say use a Navigation Controller. On the 1st view, show the 5 options in a Table View. The user selects a row, and then the corresponding section is pushed onto the stack as a new UIViewController. So, if they are in view #3 and want to go back to view #1 (to be honest, I would recommend rethinking whether or not somebody in the real world will actually want to do this), they hit "back" and then select view #1 from the table.
I can't think of a better way to do this because you won't have room to do something like breadcrumbing, which Apple would recommend against anyway. You could use a tab bar but that is more like options then some sort of wizard workflow.
If you really want them to be able to skip around the process, the combination of a UINavigation controller with a UISegmentedControl to jump to sections would do what you want. You can either embed the segmented control in the nav bar or place it just below the nav bar (which seems more like what you want since you have five sections).
If the Segmented control is not quite to your taste just put up any set of five buttons to change sections and make them visually appealing.
A "wizard" UI is typically used when you have a relatively small number of steps where one step depends on the previous, at least at some steps, the results or presentation depends on previous steps. This is like a navigation tree that usually results in the use of the navigation controller, but with only one potential branch at each each step. My feeling is that the navigation UI would be perfect, but with one exception; A button on the right hand side of the navigation bar that is the left to right mirror image of the "back" button that is usually found in the left part of the navigation button. That button would navigate to the the next step, and at each step the page presented would allow the user to fill in the information for that step. The only problem then is navigating to a step not the next or previous, and this could be corrected with a custom button that includes a drop-down list of the steps in the process. And this would fit nicely with the rest of the iPhone UI, which Gas Cubby's wizard UI (as good as it is) does not.