prevent navigationBar with largeTitles from collapsing when user scrolls swift4/xcode9/ios11 - ios11

I want to prevent the new largeTitles navigationBar from collapsing into a standard small navigationBar when the user scrolls content. i.e. always keep the navigationBar large size with title in large font.
The reason I want to do this is that I have a segmentedControl in the navigationBar above the title exactly like in the iOS phone missed calls page. Except that I always want the title and segmented control to appear. I don't want the title to disappear when the user scrolls.
Is there any default behavior that can keep the new large navigationBar from collapsing when the user scrolls?

Maybe a little late but it might be useful to somebody:
If you add a scrollView (tableView, collectionView) directly to your viewControllers view, the large title will expand and collapse.
If you add any other non-scrolling view before adding the scrollView, the largeTitle will stay expanded.
i ended up doing something like
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(view)
view.pinToEdgesOfSuperview()
self.view.addSubview(self.tableView)
self.tableView.pinToEdgesOfSuperview()
Not the most beautiful solution but it will work.

Related

Background and components stay behind bottom bar in React Native

In react native, devices with virtual navigation keys do not have any problems, while on phones with manual keys (e.g. Samsung A5,) the background and components are behind the bottom bar. When I give flex:1 or height:heightPercentageToDP(100) to my View, I have the same problem. how can i solve it? I'll be happy if you can help me.
i want to components and background start from the top of the bottom bar
You should add your code so it's easier to help you, or even an example screenshot to show your issue... but I will try to answer.
React Native has the Dimensions API which you can import in with your Views and Texts like so:
import { View, Text, Dimensions } from "react-native";
If you grab the height like this: const deviceHeight = Dimensions.get("window").height; using window as the param will give you the height excluding the bar you mentioned. Using screen there would provide the entire height.
You could use the windows Dimension to calculate any margin or padding you might need based on your use case.

Hamburger menu drop down onto a new line on xs resize

When resizing using react-bootstraps navbar collapseOnSelect the hamburger menu works properly but at xs or below xs rather the hamburger menu is dropping down onto a new line below the logo creating a larger block than I would like the navbar to be on phone displays I'd like for it to stay on the same line.
If I understand that right, the problem that you are facing is when the hamburger change it’s behavior for the smaller devices you would like it to stay dripping down directly below it and not taking the whole screen, right?
If I’m right, that’s the usual behavior for bootstrap hamburger. I would say that it will be better to follow this UX due to smaller devices having very different sizes of screens. But if you would like to change it’s normal behavior you could remove the following css class from your navbar
.collapse.navbar-collapse

Add an icon inside a Codename One TextModeLayout

My problem is that I didn't find any way to properly add an icon near a TextComponent, inside a TextModeLayout, to mask/unmask a password.
It's a layout problem only, because the code of the ActionListener to mask/unmask the password works correctly at least in the Simulator (it's taken from Codename One - Mask and Unmask Password Field on iOS).
On iPhone skin, the InputComponents labels and text fields are not aligned correctly:
On Android skin, the text is not aligned correctly if it doesn't valide:
About my code, instead of adding the InputComponent (of the password) directly to the TextModeLayout container, I enclosed the InputComponent and the Button inside a BorderLayout, and then I added the BorderLayout container to the TextModeLayout container.
When you do that the text mode layout stops working for that component as it's unaware of the layout in the hierarchy. The hierarchy in the border layout is the responsibility of that layout.
The solution is to extend the TextComponent and add that functionality to Codename One. As a workaround we might be able to rely on the behavior of the current component since the field is already in a border layout component. So something like this might work:
TextField tf = myTextComponent.getField();
Container b = tf.getParent();
b.add(EAST, unmask);

How can I rebuild Form Component in Codename One

I'm trying to create Custom Form configuration with scrollable TitleArea. The Form (black) has a BoxLayout.Y_AXIS Layout in BorderLayout.CENTER (blue). StatusBar (green) stays in BorderLayout.NORTH (green), when rest of the TitleArea (cyan) is in the first position in BoxLayout.
removeComponentFromForm function is unavailable for using in extended class. How can I remove components from Form to removing titleArea from BorderLayout.NORTH?
Why use the title area at all? Why not just add a component to the top of the box layout Y and style it as a Title that way you can scroll it out?
You can also use the new Toolbar API that includes many abilities to fade out the title as you scroll etc. See:
http://www.codenameone.com/blog/toolbar.html
http://www.codenameone.com/blog/cats-in-toolbars.html

NavBar and StatusBar in iOS7 acts strange

If I have an "old" app with a NavBar and build it with iOS7, the StatusBar is visible together with the NavBar and it looks like a mess! And if I have a flip view (TransitionStyleFlipHorizontal), that TopBar is placed below the StatusBar and when turning back the view the window jumps up in an ugly way to cover the StausBar again. Do I have to reconstruct everything from scratch to make it look good. Just to make the StausBar stay on top of the NavBar? It must a simple way to fix that but how?
Write below code in your .m file.
It basically help you to change location of navigation bar.
-(void) viewDidLayoutSubviews
{
CGRect tmpFram = self.navigationController.navigationBar.frame;
tmpFram.origin.y += 20;
self.navigationController.navigationBar.frame = tmpFram;
}

Resources