How to make a Scroll View Programmatically (Swift 2023, UIKit, Programmatic UI)

preview_player
Показать описание
Learn about the scroll view in UIKit. This video teaches you how to use the UIScrollView with Autolayout programmatic UI. The constraints can be tricky when working with a UIScrollView programmatically so this video will yeah you how. Swift UIKit UIScrollView Scroll View.

If this video helped out and you want to see more iOS/Swift videos,
please consider subscribing.

If you liked the video, leave a like or comment!

Code:

If coding is too hard, you can hire me:
Рекомендации по теме
Комментарии
Автор

Lately, I wasn't able to fully understand how UIScrollView is working, but this really helps me. Thanks man❤❤

azozsalah
Автор

Really helpful to know how UIScrollView works. I appreciate it so much!!

kaibu
Автор

Thank you, it helped me to learn how to scroll the view in scrollview programmatically

mohanr
Автор

Why are you adding imageViews onto self.view 12:02, but constraint it to contentView anchors? I guess we should add imageViews onto contentView

horty
Автор

My brain gonna blow up, why they made uikit such hard

abdurahmon
Автор

Thanks. Great video. :)

I've been doing programmatic UIKit for a few months now and it's really strange to me why you have to set the width and height after already constraining all for sides.

Interestingly, you set `hConst = UILayoutPriority(50)` which is identical to

Apple's documentation says this: " When you send a systemLayoutSizeFitting(_:) message to a view, the size fitting most closely to the target size is computed. This priority is quite low. It’s generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower."

So I suppose it would be better to set it higher or lower. In any case, `priority` is a new concept for me, so thanks for teaching me this. It's already coming in handy as I came here trying to solve a particular problem.

djryanashton
Автор

Do you know how I can have the same kind of layout but with scaleAspectFit? I want the images to not get cut and take the whole width of the screen. For that, the height of the image would have to be variable, so I can't set a height constraint, but without a height constraint the images aren't placed one right after the other anymore.

bortanradu
Автор

Can you do videos on programmatic CollectionViews?

rparham
visit shbcf.ru