The whole question is in the title. The 'United Kingdom' header should be at the top, but instead it is place away from the back button.
The worst part is, when I then go onto the 'Diamond-Encrusted Ring' page, it creates a new back button and even more spacing. I would prefer no spacing and to get rid of the 'Locations' back button once on the second page.
You use NavigationView only in the root View. So remove NavigationView from the views where this behavior is happening.
Related
i would like to ask if there is any ways we can reset our view in UIPageViewController implementation. For example I have two views,
in View A, there is a button which changed text upon clicking as well as a tableview. Once i have clicked the button or when i have scrolled to the middle in my tableview, when i have swiped to View B, my states in View A will not be reset when I go back to View A where the button's text are not reset and my tableview is in the middle where from where I scrolled earlier.
Is there any ways once we move pages between UIPageViewController, the pages reset their states?
The answer is "It's kind of complicated."
The background:
If you only have 2 pages in your page view controller the page view controller will probably keep strong references to both, and so they will retain their state as you page back and forth between them.
If you have more than 2 pages, and are not showing 2 pages at the same time and using a center spine, the pages that are not either currently visible or next to be displayed will likely get released and you will then recreate them when the user displays them. In that case the pages won't remember their state unless you do extra work so that they save their state when they are moved off-screen.
Your case:
You always want your pages to reset when the user swipes to a different page and then back again.
I'd suggest you write your pages' view controllers logic so they respond to viewWillAppear(animated:) by resetting themselves to their starting state. (scrolling table views to the top, resetting button states, or whatever.)
Ideally, you might want to make that an option that is controlled by a flag (resetsOnAppear: Bool). That way if you later decide you don't want that to happen, you can just set the flag to false and don't have to refactor your code.
I am building a Calendar app. I have Navigation based app template. Navigation controller has segmented control having namely Daily and Weekly segments.
Upon clicking the segments i show the relevant View having status bar, navigation controller and bottom toolbar. This is working fine.
My daily view will have a top view and scrollView. Top view will have previous button, next button and date in label. When i add only scrollView inside my dailyView than it works fine, but upon adding top View it gives crash when i try to scroll the scrollView.
Please suggest is it possible? Else, what could be a better alternative? I even tried adding a second navigation bar (this time using the Interface Builder), button than i am not able to change the date in label.
Please let me know if more clarity is required.
I see you have two questions:
Please suggest is it possible? Else, what could be a better alternative?
So I'll go ahead and answer those questions:
What you're trying to do is possible, so there's no need to look for an alternative.
However, I guess the real question is: "Why is it crashing?" and I certainly would answer that, but without crash logs and(/or) code it's nearly impossible to give you a usable answer.
I have 3 view controllers, one is the root, which pushes the next, which pushes the next. Each time you can go back (pop), using the normal back button that appears by default.
However when the 3rd view is visible, when the user taps the back button I need it to skip out the the 2nd view controller, and go (pop) directly to the root view controller.
How can I override the default back button behaviour? (I'd like to keep the shape of the back button, and not replace it with a square bar button)
You could try to have an object implement UINavigationControllerDelegate and enforce this behavior. You could also have a designer create the same size and shape asset and you could use this as the background for a button.
However, I'd rethink your UI if you really need to do this. It is contrary to the user's expectations of how a navigation controller should work.
I have a UISearchBar which is subviewed by another view when a button is pressed. When it loads, it looks like the following (minus the red scribbles):
I would like to have the UISearchBar view be removed from the parent view controller when the tableView (the area with red scribbles) is clicked and is empty (no search has been made yet). I'm having a difficult time figuring out the best way to do this.
I have tried to put a transparent button in that section and add it as a subview to the search bar. However the button is underneath the tabl view area, so when the table view is clicked, the search bar loses focus and the uibutton is only then accessible.
Does anyone know how I can remove the search bar from the parent view controller when the empty table view below it is clicked?
Thanks.
To bring the transparent button up and make it catch all touched first, use [button.parentView bringSubViewToFront:button].
Another approach could be to catch the search bar losing focus (since you say you see that happening), by putting
– (void)searchBarTextDidEndEditing:(UISearchBar*)searchBar
in the search bar delegate, and handling it from there.
I am trying to set up a Modal View Controller, that that lies below a fixed toolbar. therefore the toolbar is supposed to stay on top while the modal view rolls in.
the Safari-App does that for example, when hitting the bookmarks-button. the toolbar stays, the buttons change..
I tried a couple of things like pushing the toolbar to the front and ended up not using the presentModalViewController method at all, and animating the new View manually into a subview instead. but that brought a couple of other issues along.
I'm not sure what you are saying, when you press add bookmark in safari, a new modal view shows with no tool bar. The navigation bar at the top is not a tool bar if that is what you mean. They are UIToolbarItem set into self.navigationItem.
All modal views I've seen are animated until they take up the whole of the screen. Those modal-like views that only scroll up to a certain point in some apps, are done by hand. Maybe you can cover those issues encountered when doing this by hand in another post?