only scroll half content UIScrollView Swift - swift

in my app, I would apply Scrollview which there are textfields and labels.
but I was very confused, because some textfield can not be shown on the
scroll view and the textfield "country" and further textfield not selectable. scrol bar on scrolview Nor can slide all the way down, only half of the frame content view.
how so I can scroll through the entire content and can use existing textfield?
Image

If you have multiple subviews, you need to update the scroll view content size
I you use autolayout, you can follow this tutorial.

Related

Smooth Scrolling between Table/Collection View and the Scroll View

I am implementing a scroll view which consists of an image underneath it is a collection view.
What I want to do is a smooth scrolling between the page as if the collection view is just elements in the scroll view.
But what happens is the when I scroll, the collection view needs to be dragged twice to exit it or to enter it.
What I mean is that when the scroll view first appears there is an image and under it is collection view. when I scroll down if I touch the image, the scroll is done correctly, however, if I touch the view the image is still here and a small scroll is done then when I scroll again the scroll is done right and the collection view takes the whole screen
After that when I scroll upwards, the same happens a small scroll happens then I have to touch again to do the scroll right and show the image.
EDIT: This GIF shows would clarify what I mean :
https://im2.ezgif.com/tmp/ezgif-2-75ed33ccd665.gif
Edit: The best solution was to create a TableView/CollectionView header and and my header in it and scroll normally for the table/collection view.
Old solution
The solution as provided in a comment by #MayurKarmur was to disable the scrolling in the collection view and adding height to collection view according to its content.

Making a Title scroll in a UIScrollView with the text below

I have a storyboard with a UIScrollView taking up the entire iPhone screen. I have a label at the top for the title, and then a textview below that which has text loaded into it from a .txt file. However when I scroll, it scrolls through the large body of text with the title staying put at the top of the view, even though the label is based in the scrollview rather than outside of it. Any ideas how I can fix this?
Thanks!
textView has its own scrolling method built in, so your textView will scroll independently of your scrollView. Create the title within the textView or set text view not to scroll in Interface builder and use your scrollView

Unable to click on any part of the UIScrollView to scroll through the images. There is only a specific porition I can click on

I've some UIImages loaded into a UIScrollView.
However, when I try to scroll through these UIImages, I can only click on a specific area in the screen.
What is the property I should look out for to expand the "clickable area"? Such that I can click on any part of the scroll view to start scroll through the images.
Is there anything to do with content size of the scroll view?
Make sure that -userInteractionEnabled is NO for the views you add to your scroll view.
Update:
Set -clipsToBounds to YES and see whether the scrollview's frame is just too small and the content goes beyond the bounds of the view.

View elements resize problem

I have a UiView which contains a UiWebview, UIButton and a UITextView as its elements.
I add this UiView to a UIScrollView and resize the frame so that the text view is not visible. When i click the button i resize the view to display the entire UIView including the UItextview.
The problem is , the text view appears below the view when i resize the frame. When i click expand it covers the text view too.
When view is first added i want the view to display just the webview and the button and when button is pressed it should display the text view.
How do i achieve it? Has it got to do with view hierachy?
you should enable clipping on the UIView .
edit:
I wouldn't resize the view. Instead I would just change the hidden-property on the textview. If you want to add some animations later then you can modify the alpha-property as well.

Making a view scrollable when keyboard active

I have a view with half a dozen text fields and labels, and a button.
I want it to be that when the keyboard pops up, the view becomes scrollable, so you can scroll the view up and see the bottom half of the fields without having to dismiss the keyboard to get to them.
Just putting it inside a UIScrollView doesn't seem to do it.
You have to set the scroll view's contentSize to enable scrolling.