Large title automatically expands when collapsed and button changes title. Any thoughts? - ios

I have a view with a large title navigation bar, and a scrollview with a content view inside it. The scrollview is scrolling normally (alwaysBouncesVertical set to true) and the large title collapses and expands as it is supposed to.
I have a button at the bottom of the screen, and when I click it, I change its title. The weird thing is, that when I change it, if the navigation bar is collapsed, it will immediately expand and make the scrollview scroll a bit up, making the button go almost totally out of the screen. From this point on, scrolling works normally again and I can scroll back to the button without any problems.
Do you guys know why setting the title with the regular
self.button.setTitle("", for: .normal)
Would trigger the navigation bar expansion?
I tried setting the text to many different strings. I also tried doing other changes to the button layout (such as disabling it) but none of these changes produced the same problem.

Related

Bottom layout guide prevents interaction with the uitoolbar which is exchanged with the uitabbar

I am trying to make it possible to exchange the tab bar with the tool bar on iOS when the UITableView enters the editing mode.
However, when I set the
func updateBottomBar() {
tabBarController?.tabBar.isHidden = isInEditMode
actionToolBar.isHidden = !isInEditMode
}
, everything displays correct, however I can not interact with the toolbar. It seems like it is under the bottom layout guide, and the touches cant pass through. I tried bumping the toolbar.layer.zposition to 100, didnt work.
Note: if I programatically reposition the ToolBar to be a little bit higher, then exactly the portion of the ToolBar which is above the top of now hidden TabBar will be okay to interact with. Say i put the ToolBar 20points higher, then the 20 top points of the ToolBar allow me to press the buttons, and the bottom part doesn't allow.
I have:
extended edges under bottom bar disabled
Hides bottom bar on push disabled
user interaction enabled
right now. Changing those didn't give any success.
One possible issue could be your userInteraction of your custom tabbar being set to false.
You can do that directly in the your storyboard by opening the attribute inspector on your ActionToolBar
Also, to confirm you don't have any invisible view on top of your custom toolbar, you can use debug the view hierarchy when running on your simulator:

Navigation bar prompt & height resize animation

Good day!
I have an embedded navigation bar in my app.
mainView is a ViewController with tableView in it.
On first launch there is no prompt text on navigation bar. When you get to options (second view controller) you can set a text to your main views prompt. So after you do so, returning from "Options" to mainView triggers nice and smooth animation on navigation bar increasing its height and prompt text appears.
When i launch the app for the second time, where prompt text is loaded, the text is ok, the size is ok, but the animations of height resize start to get glitchy when switching views, navigation bar height jumps from big to small w/o animation, although text appears to dissolve as usual.
Here is an example of where i switch views in a loaded app:
If i go to options view controller and again set the prompt text -> animation of height increase between views gets fine.
I'm sure i am missing something at launch, something like tableView.reloadData() in viewDidLoad, but for navigation bar.

NavigationBar button mis-alignment in some views on iOS

I have a couple views that I'm showing as examples of a problem I'm having with buttons in the UINavigationBar. Here is a view showing the button correctly:
Here is the button in another view mis-aligned:
In both views, I have a UINavigationBar, and within it, a button (which is an image). In one view, the button displays aligned fine and fits in the navigation bar properly; however, when I use the back button (from the good view), the button on the navigation bar mis-aligns (seems like it's moving down, or zooming, or something). I've scoured the code, and done lots of adjustments/tweaks in the storyboard for the view, but can't figure out why the button moves in the simulator.
I'm fairly new to iOS development, so I've turned on/off endlessly different settings in the storyboard, and nothing fixes it.

UITableView and UINavigationBar customization confusion. Any advice on how this was done?

Here is a part of the AirBnB app I would like built.
Here are the 3 questions that I'm in need of advice on.
How do i get a cell on a UITableView to act like the [ MORE FILTERS ] button? The button seems to act like a UITableView cell that always stay at the top. YET, it fades away just before going out of scope. Is this even a tableViewCell?
The view [ARRIVES | DEPARTS]. What view is this on a UITableView? When the tableView is scrolled all the way to the top it connects seamlessly with the [MORE FILTERS] button making it seem like its one view. But when the tableView starts scrolling, the [MORE FILTERS] button can be seen sliding over it as it fades away.
What is the [SHOW FILTERS] button? Is it a UINavigationItem titleView property or some separate view? As the table scrolls up it can be seen attaching itself to the UINavigationBar in a fade transition. At first i thought it was a just a UINavigationBarItem, but I do not know how to add items under the title of the bar. Any clarification on what this is or how can be accomplished?
I have already looked at Apple's Example on customized UINavigationBar, but it doesnt provide any clues to accomplish this. Any help appreciated
just like you did, when I came across an application like this one which has cool UI effects and animation, I would like to analyse and if possible try to do the same effect by myself, so that I could get innovations as well as knowledges.
Let's analyse it first, at the meantime you will probably find all the answers. I just drew a graph which shows the UI hierarchy of the screen, of course this hierarchy is based on my analysis, I cannot guarantee that the hierarchy is 100% correct.
I will do a bit of explanations here. From top to bottom:
1. The Navigation Bar(Red), just a opaque navigation bar, nothing special;
2. The Show Filters View(Purple) is a view which anchors to the bottom of the Navigation Bar(Red), and it is hided when the screen launches. Please note that this view is not a subview of Arrives & Departs View(Blue). It is added directly to the view controller's root view. Which means Purple and Blue are siblings;
3. The Arrives & Departs View(Blue), nothing special;
4. The More Filters View(Green), nothing special;
5. The Table View(Orange), nothing special;
So from my analysis, Purple, Blue, Green and Orange are all siblings.
Now let's move on to the fancy UI effects and animations. The trick here is you need to observe the change of the table view's contentOffset (I recommend to do it in the scroll view's delegate - scrollViewDidScroll), and move, hide or show the views accordingly. There are four stages:
1. The initial stage, like the graph above.
2. The Blue starts fading out, Green moves up as the finger moves, Orange increases its height. (Purple is still at the same position and hided, I just removed it from the graph in order to make it clearer);
Blue totally faded out, Green starts fading out and Purple starts fading in. Orange is still doing the same - increasing its height;
Green totally faded out, Purple totally faded in and Orange increases its height to fill the screen and then anchors to the bottom of Purple.
The [MORE FILTERS] button does appear to be a cell of the UITableView. Since it is a different type of cell than the other cells containing the UIImageView and the UILabels using a different identifier you can tell the cell to fade away with an animation. Try this link for more information.
The [ARRIVES | DEPARTS] seems to be its own view. I believe that this and the tableview are both part of a UIScrollView. This is the reason that it seamlessly disappears when the [MORE FILTERS] cell scrolls up towards it.
The [SHOW FILTERS] button could just be a part of the navigation bar. When the scrollView finishes scrolling the navigation bar can be extended. However, it is also possible that the button is in a view of its own and is hidden until the scrollview finishes scrolling. Either way should be possible but I would recommend putting it in its own view rather than attaching it to the navigation bar.

Attach a Segmented Control to UINavigationBar

In my App, I have a map view and I want to use a segmented control to change the map types (Standard, Hybrid, Satellite). The way I have the app set up, the status bar is hidden and it animates in, moving the navigation bar down a bit. To make sure it doesn't look awkward, I want to make it so the segmented control is attached to the navigation bar so it animates nicely as the status bar comes in. This is basically a picture of what I want to do:
So I noticed that the segmented control is inside a toolbar, so I contain mine in a toolbar as well. I've then tried adding the toolbar to the navigationBar as a subview. (self.navigationController.navigationBar). That works well accept that it can't be tapped because the navigation bar's frame doesn't enclose the extra space, so it can't receive touches. I tried making the frame of the bar bigger, and that worked, but the title and the buttons went away. Obviously there is some way to do this, and I would appreciate any help. Thanks.

Resources