iOS swift move elements after some hidden - ios

I have some question about moving elements in ScrollView, let say i have some form from few elements and button in the bottom on screen.
This view is scrolling and now i have some problems when i need to hidden some elements on this form, elements witch will goes after that stay as is, and as a result i have some blank space on form where places some hidden elements.
I think what is elements have Top space to options if i hidden some of them all others will move up after that but it's not.
I can not find some way how make auto up this elements what some elements was hidden.
Thank you

Related

Vaadin: second scrollbar appearing seemingly randomly in AppLayout

My application is using a com.vaadin.flow.component.applayout.AppLayout with a header and a drawer (a standard layout inspired by misc. example programs). The lower right content part is populated with VerticalLayouts that have a #Route(value="foobar", layout = MainLayout.class) annotation, so when clicking on one of the "anchors" in the drawer the corresponding view is added.
That works all nice except for one thing that annoys me:
One of my views has four Accordion components (2 containing a couple of labels and a TextArea each, one containing some textfields and a chart. The forth contains some text fields and a button).
When I unfold these accordions then typically when expanding the third or fourth there is suddenly a second vertical scrollbar appearing just inside the outer, normal scrollbar. Already two opened accordions are higher than what fits a typical browser window, but here the size and the scrollbar is adjusted correctly. Sometimes, but strange enough not always, the scrollbar also adjusts properly with three opened accordions. Sometimes already with the 3rd, but definitely always with the 4th accordion that second scrollbar appears. The combination of opened accordions does not seem to play a role, i.e. there is no accordion that ALWAYS triggers that scrollbar appearing.
I find this second scrollbar most irritating and annoying when navigating the page. Any idea what could cause this? And how to force a single scrollbar only?
BTW: I experimented with wrapping the entire content inside a Div but that didn't change anything - the second scrollbar still appears as described above.

How to add a button to the side and in between UIStackView rows

Imagine a horizontal stack view that contains two controls. Hopefully the type of controls doesn’t matter. Let’s say UITextFields. They’re set to take up 50 percent of the width via distribute evenly on their parent stack view.
Now imagine that I want to add more than one of these things. To keep things simple imaging two of them nested inside a vertical UIStackView. So now we have four text views each taking up a quarter of the parenting vertical stack view.
My question is this. For every pair of text fields, how can I get a button right in between the gap between that text field and the one below it, to the right. So for each pair one button to the right and under it right in the center of the gap between the top pair and bottom pair of text fields.
The idea is to make a control consisting of the two fields and the plus sign to the right and below. Hitting the plus sign would allow for the appending of an identical set of controls.
Thanks I’m advance. Sorry if this makes little sense.
I should add that the button should overlap the vertical space of both text fields.
Okay, thank you. I shall add an image. Imagine all of the fields besides those on the far right as text fields. The ones on the far right are buttons. Those buttons would add a new set of text fields, a pair to the left side.
I'm getting some ideas in my head since writing this originally. In my head you might have one vertical stack view. That vertical stack view would contain a regular UIView containing a pair of text fields and a horizontal stack view to the right. These would be nested inside a horizontal stack view where the text fields would be aligned to the top on the left and the center or bottom alignment for the button to the right.
Does that help?
When you hit the button on the far right, you'd get a new pair of text fields plus a new button.
Okay, I think I'm getting somewhere. Now all I have to do is work out how to do it entirely programmatically so I can add the views dynamically...
Have the buttons be in their own vertical stack view, with each button having the same height as the row of the control pairs, but the top layout margin of the buttons vertical stack view would be set to half the height of the control pair so that the buttons always appear in the middle.
In summary you'd have a horizontal stack view which contains two vertical stack views - one with the pairs of controls, and one with the buttons. you'd add a button and a pair of controls (which are arranged in a horizontal stack view of their own) on every tap on the button

How to hide view graphically while maintaining presence in stack view?

I currently have a stack view that is horizontal, fill, fill equally. Inside, there are 3 generic views with different coloured backgrounds.
My current problem is that, when I set one of the views inside to hidden=true, the other two views immediately expands to fill the void. I don't want this. All I want is for the space to remain blank and the target view to be "invisible" both graphically and to UI input events.
Instead of setting isHidden=true you could set view.alpha = 0 to make it invisible and also view.isUserInteractionEnabled=false to disable UI input events.
*As #robmayoff pointed out below the isUserInteractionEnabled=false is not actually required.
As I can see in your screenshot, you are using the constraints. So, when the element hides, collapses and the other expand.
Use 'opaque' flag to make it invisible.

UIViewController with UITableView and TextField storyboard placement

This might be a simple question but using storyboard I can't seem to position my table, a message field and a button correctly. In the picture below, if it's positioned that way, only then do I get to see the text field and button at the bottom of the screen and the table view takes up the rest of the screen. If I drag the text field and button to the bottom and resize the table, the text field and button disappear and the table is cut off. Why is that? Is there a solution to this without doing it programmatically?
Easy solution is to remove all constraints then position them where you want them.
You'll find you get different effect when try to reposition items depending where you drag from for example double tap an item and nudge it with arrow keys or grab the middle to move it resizing via the corners.
But in my opinion it's easier remove all constraints from the view and then set them as you go.
Also you might want to consider using a container view for the table view and have a separate UItableViewController that way you can easily separate out that the tableview logic from the other ViewController. It will help stop things getting a little messy later on as project grows.

Is there a way to Auto-scroll jquery-ui sortables in all connected lists?

Using jquery-ui's sortable plug-in, I have two connected lists that have scroll bars. I would like to be able to scroll as i drag an element from either list. Current behavior of the Sortable plugin is that if you have the scroll:true option, and no ui-helper (or a ui-helper that is appended to its original list) then the scrolling and dragging will only happen in this list and not the ones connected to it. If you have it appended to a div that contains all connected lists, then it won't scroll as you drag at all. Does anyone have a work around for this?
Here's my specific situation in more detail:
I have two connected list one below the other. The one on the top has a scroll bar. If I a drag an element from the top list to the bottom list, the scroll bars don't scroll down with the element, but the element's placeholder still stays in that list (just the hidden part that is not scrolled to). So, if i drop it there, it gets dropped in the top list rather than in the bottom list. This especially happens if the bottom list is empty.
I have a ui-helper appended to a div that contains all the connected lists.
Is there a way to make the scroll area scroll with the element? A less desirable, but still acceptable, alternative would be a way to make it prefer (on dropping) the list that is visible.

Resources