I have an unusual UI requirement that I believe requires a custom modal presentation style, of some sort. I effectively need a floating bottom bar combined with the default pageSheet animation, for an iPad only app.
Everything about the pageSheet presentation style is perfect, except that I need to put a floating bottom bar below the presented view controller.
When the view controller gets presented, it should come up from the bottom, and underneath, the floating bottom bar. Likewise, on dismissal, it should come down from the top and transition underneath the bottom bar.
Mockups:
I have no intention of reinventing any wheels here, so any existing libraries / GitHub projects are acceptable; however, assuming there aren't any, what is the best way to do this? I'm not even sure if I'm thinking in the right direction since the floating bottom bar should be present not only before the presentation, but also during, and after. Moreover, the content on the bar must be interactable at all times (with the exception, perhaps, while the animation is in progress).
Full disclaimer, I am not an expert when it comes to custom transitions/presentation styles, so any help is appreciated.
Edit: Code examples are welcomed, but not required. I'm very much interested in the basic mechanics/structure of a feature like this.
Related
A picture is worth thousand words in this case. I have a tableview present modally onclick from other view controller (with one navigation controller in between for the navigation bar, if that is important to you). Somehow there is some strange, (1) gray space at the top right under the navigation bar overlapping on top of the tableview, and (2)gray space near the bottom of the tableview right below the last cell with button, as shown in cap screen. I have completely no idea what that is.
I have another project which I use almost completely same setting for the tableview and these two gray bars do not occur. So I feel quite strange as to how that happen.
Can anyone enlighten me on this? I don't even know how to call these two gray bars here.
If scroll to top, the two problematic areas appear a bit differently, please see can screen below. It feels like something due to a same problem which I don't know what it is.
How can I achieve when the user scrolls in the ViewController down to make the highlighted text show up in NavigationBar and when the user scrolls back up to make it disappear again? Similar to Apple's one in Settings app in Apple advertising (https://imgur.com/0FeFJ3s)
Edit:
Looking at the image you posted, this seems to be the default transition a large style navigation bar gives you. The only tweak that's been done is centering the title text.
Original answer:
The text in the navigation bar follows the .title property of your view controller. However, setting the title is not animated. Depending on your use case, that may or may not be enough.
If you want to do things a bit more fancy, you have some control over the .navigationItem.titleView in a view controller. This way you can use a custom view in the navigation bar. Using this, and a bit of fancy programming, you can animate things there.
Last, you can read the scroll position of a UITableView or a UIScrollView by implementing the scroll view's delegate's scrollViewDidScroll method. How you know where the labels that are interesting are depends on the content of your scrollView, so I can't answer that for you.
I would like to have either custom UIView or UIToolbar or inputAccessoryView always visible at the bottom of the screen and not being covered by keyboard when one is presented.
Also keyboard should be visible, meaning it should be presented on top of that view and dismissed accordingly.
It would be nice to have that view as part of the UIViewController, but if it can be part of keyboard it is also acceptable as I have an idea how to achieve the visual impression of it being a part of UIViewController and always visible.
I've run into answers explaining how to add custom toolbar docked at the bottom and shown on top of keyboard once presented.
I've also run into posts explaining how to create a custom keyboard.
There are also some stating keyboard can't be positioned otherwise than docked at the bottom.
I understand if Apple is forcing consistency, but having that view always visible would keep consistency across my app. Therefore, if the final answer is it's not possible, I would appreciate firm explanation or link to apple's mention of this issue, cause I wasn't able to find one so far.
Thanks a lot!
I want to know how, if possible, one can keep the scrollview on top of the navigation bar. When I put the scrollview on my view controller it covers the whole screen except for the navigation bar and toolbar. I want to keep it on top of everything.
Use containerView to achieve this because containerView can contain Navigation controller within it like other controller.
And Add scrollView within containerView like below shown -
Hope it will work for you :)
I don't think there is a simple way to put the scroll view "on top of" the navigation bar, and it is certainly something that Apple Devs never intended to be done. Generally (although certainly not always) that means that if you want your code to work consistently as new versions of Swift and iOS are released, you shouldn't do it. The other reason you shouldn't do it (probably) is that unless you setup some sort of fancy "touch through" system you would never be able to actually use the nav bar, at which point you might as well just save the trouble and not have a nav bar in the first place. You can, however, easily check a box in your storyboard to have the scrollview go under the nav bar, and have the nav bar be translucent so that you can see the scroll view content under it.
Good luck!
I think preset modal(UIModalPresentationOverFullScreen) is what you're looking for.
I've got a map view, as a subview within a semi complex view hierarchy. Everything works fine, except that the accuracy circle, pulsing wave causes the underlying map view to bleed onto both the navigation bar, and the tab bar whenever the blue, user location pin is near either one. I've got all the parent views' clip subviews set, so wondering what else might be the problem. The view hierarchy is window/scrollview/content/mapview. Thanks.
Update:
I've since tried rearranging the view hierarchy to test various layouts, and confirmed that all the parent views have clipsToBounds = YES and still getting the bleed whenever the "pulse" occurs. Odd things is that the only two views affected by this are the nav bar, and the tab bar. The undesired behavior is that when the pulse ring expands, near either the tab bar or nav bar, the underlying map view begins to draw under the area within those views where the pulse intersects them; as if they are being wiped away and exposing the map view underneath it
Thought I'd share some recent info on this, in case somebody else happens to hit this same issue.
In my case, I had to set the parent view of the mkmapview (content view) clipsToBounds property NO, and everything worked. It seems counter intuitive, I know, but it's the solution an iOS support engineer proposed. Technically, it's not a supported configuration, but the tech engineer also indicated that it shouldn't bleed like that anyway. I filed a bug for it, as he suggested. The only downside to this is that I had to let go of rounding corners and drop shadow; can't get that without clipsToBounds=YES.