RayWenderlich.com Layout in IOS Course - Part 5

It's been a while but for god reason! I've got a promotion at work, which means I've really got my future set. However, I am not going to abandon Swift. My work over the past 20-ish months has been rewarding and to let all of that go would be a shame. True, had I not got the promotion, I would probably be gravitating towards Swift more with an aim to transition to a career in the future. Anyway, that COULD still happen but it does make me want to rethink my goals a bit. We're also on an early holiday, so plenty of time to code and do a reflective entry of where I am and where I want to be. That will happen soon! For now, let's get on with the auto layout course!

Start Time - 9:42

Intrinsic Content Size

So this is the size that will fit EXACTLY into a a view's content.

Content Hugging and Compression Resistance - these are rules that show the importance of contents not shrinking or resizing, bigger than the intrinsic size.

4 priority values to set. Vertical and horizontal for each of the above.

Content size ambiguity - when the CH and CR have the same priority. So AL does not know whether to grow or clip the size of the object.

Nesting Stack Views



So like the above!

A neat trick - command and d - duplicates an item.

Stack View Alignment and Distribution

With alignment you have left right and centre options for how the objects are aligned. Default is fill, so that the stack view is filled (for horizontal). You can also line to first or line baseline - the furthest point up or down.

So that is about alignment, makes sense.

For distribution, it's to do with spacing rather than how lined up the objects are. You can have equal spacing or equal centering.

Challenge!

Last bit for now! This is what we are going to make! Using the objects given....



So multiple stacks and options going on here. Cool!


Right we're making it from scratch! First of all we need a vertical stack view, stretched out. Then there will be views within the views...

Here's what I have! I got ALL of the objects in, then did the embedding. That worked better than starting with the stacks.




OK I was missing the top right bit - thought there was an image missing! Let's add that in.

Yep all done now



A tough challenge in the end but all good!

So this course is going well. Stack views is 100% the way to go, especially with the use of nested views! That will do for now. 

Finish Time - 10:58 (1 hour 10 mins approx)

Comments

Popular posts from this blog

*Xcode Project Entry 2* F1 Quiz - part 1

Angela Yu Course Part 10 (up to lesson 112)

Angela Yu Xcode 12 Course - Part 7 (lectures 74 to 79)