Move visible images in StackView closer to leading space - swift

I have a horizontal ScrollView of 20 (110 * 130 point) UIViews contained within a StackView. Each UIView contains an image.
When certain UIViews are hidden the UIView width is maintained at 110points. However, spaces are left were the hidden UIView should be.
I have been practicing with a StackView of 3 UIViews and hiding the center UIView. This leaves a space in the middle...
I would like the 3rd UIView to move into the 2nd UIView position (middle) and perform this for subsequent UIViews later on.
Does anyone know how I could go about doing this? Is this even possible?
I was hoping to accomplish this with a UICollectionView, however, I don't think you can drag an image from UICollectionView to UIView
Drag and Drop Image from UICollectionView to UIView?

A storyboard isn't meant for these complex user interactions, so I recommend you programmatically create your stack view and then set its constraints programmatically as well. This let's you change elements' heights in your code easily. This might help you get started:
Add views in UIStackView programmatically

Related

How to scroll a UIView to a certain height and after reaching that point scrolling inside the UIView?

Hey guys I'm new to swift programming. I've been stuck with this problem for a long time. So I have a UIView that starts in the middle of the ViewController, inside the UIView (green) is another UIView (yellow) with dynamic labels in it, so the height can change. You should be able to scroll the UIView(green) up until the NavigationBar and then you can scroll "in" the green UIView to see the rest of the content in the yellow UIView.
How can I achieve that you can scroll to a certain height and then change to scrolling inside the green UIView? Rough Construction of the UIViewController
I have a scrollView for the green UIView, and I set it under the NavigationBar, but it doesn't stop there, you can pull it over that point. Then I tried to set another UIScrollView inside the green UIView to scroll through the yellow content but I don't know how to constrain it because it's dynamic.
I'm thankful for every tip you guys have.

Using the UIScrollView

I currently have a UIStackView inside of a UIScrollView, positioned in my storyboard. I then programmatically add multiple UILabel based on user input. When the program is run, instead of being able to scroll, all the labels cram within the defined view. When the first label is created it appears in the centre of the UIScrollView, and subsequent labels decrease spacing between each other and "try" to be centred. This eventually causes the view to become overloaded. Any ideas on why it isn't scrolling? Thanks.

StackView Horizontal Images - Maintain same images width if hidden

Let say, I have a horizontal ScrollView of 20 (110 * 130 point) UIViews contained within a StackView. Each UIView will contain an image and a label.
If I decide to hide certain UIViews from the StackView it changes/stretches the width of the UIView.
How would I be able to maintain the same width/height of the UIView?
So lets say if I decided to hide 19 UIViews contained within the StackView. Is it possible to only show 1 UIView (110 * 130) within the StackView?
I have tested this out using a StackView of 3 UIViews in Storyboard with no success.
If I get this to work then my plan is to programmatically code in the 20UIViews.
I would appreciate any help.
You need to set constraints for the views inside the stack view. So in your case, the width constraint isn't set for the UIViews and is therefore causing weird problems.
I recommend checking out this guide on working with stack views in storyboard : http://www.appcoda.com/stack-views-intro/

Resizing a UIView containing UIButtons makes those buttons lose perspective position

I got a UIView that contains an UIIMageView and several buttons that are allocated on certain position related to the image of the UIIMageView.
The frame of the UIView is (0,0,250,250)
the UIIMageView that is within the UIView is set to autorisizing (all) in IB.
All buttons are set to autoresize (none) and origin middle.
When i change the frame of the UIView i.e (0,0,500,500) the UIIMageView (and image) resize OK but the buttons lose their perspective position by a few pixels (about 2 to 3 in the vertical and horizontal axis).
Is this normal? can someone advise?
Try putting the buttons inside another UIView and then setting the autoresizing options on this new view. You should leave the buttons without autoresizing inside the new view.
there is no answer after all.
I must accept the fact that the resized view and the buttons within it will lose perspective position by 2/ 3 pixels off the x/y axis...
strange....

How to scroll a simple UIView (not uitableview) in iphone?

I have added some uitextview in my uiviewcontroller.But some of the textViews are not seen as view is small compared to the number of textViews. So I want scroll it, so that i can see the other textViews also. One more thing-- when i want to type something in the lower textView then it hides because of the iphone keyboard.If somebody knows about it, please give me with the solution.Thanks a lot.
Add UIScrollView in self.view. Now add all subviews to UIScrollView.
Provide contentSize of UIScrollView in width and height.
if heigth > 460 it will scroll vertically
if weight > 320 it will scroll horizontally
If any condition doesnot matches then u will not be able to scroll
You simply have to use UIScrollView.Instead of adding all of your subviews(in your case multiple UITextViews) in the main view, just add a srollView in your view and then add all subviews in that scrollView.UIView doesn't have the property to scroll.And don't forget to change the contentSize property of scrollView.
You must implement a UIScrollView. This is a fundamental class when it comes to iPhone development (and just Apple development in general) and it should be mastered before you continue onto more advanced topics. Here is the documentation for the class :
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html