Stanford - Developing iOS 9 Apps with Swift - 4. Views

Stanford iOS · 50K views · 2016 · 1:19:46

Open on YouTube

University lectures & coursesSoftware (other)lecturedated

Why Stack Overflow recommends it

Stack Overflow users link it as the source for specific iOS view behavior, such as view initializers, property initialization, and argument labels, and cite exact timestamps in the lecture.

Recommended by 2 people across 2 different months, 2016 to 2017.

What it is

A Stanford CS193P lecture from the Developing iOS 9 Apps with Swift course, taught by Paul Hegarty. It covers UIView basics and custom drawing, then walks through a live demo building a FaceView that draws a smiley face.

What people said

Recommends MStew · 2016-10 · Stack Overflow · on “Argument Labels in C#”

Matt, I see what you mean. Here's a link to a Stanford iOS lecture where Paul explains a good scenario for argument labeling. Fast forward to 1:07:20 - [this video]

Recommends michaelgill1969 · 2017-11 · Stack Overflow · on “Resize an inset UITextView when device rotates”

I think the answer is at 13:45 of Stanford - Developing iOS 9 Apps with Swift - 4. Views [this video] . I'll answer my own question soon if that is indeed the solution.

Cites mfaani · 2016-06 · Stack Overflow · on “How properties( stored and computed) are accessed during instantiation?”

I am taking the CS193 class. From this exact moment of the video [this video] . Option 1: class FaceView: UIView { var scale: CGFloat = 0.90 var mouthCurvature: Double = 1.0 private var skullRadius: CGFloat { return min(bounds.size.width, bounds.size.height) / 2 * scale } } Why can't I write Option 2: class FaceView: UIView { var scale: CGFloat = 0.90 var mouthCurvature: Double = 1.0 private var skullRadius = min(bounds.size.width, bounds.size.height) / 2 * scale } The professor goes and explains that you during initialization you can't access your own property and therefore if you do option 2, you will get an error saying: instance member 'bounds' cannot be used on type 'FaceView' . OK, but aren

Cites Daniel with a Spaniel · 2016-08 · Stack Overflow · on “Initializing UIView init AFTER its superclass init?”

Looking at the a lecture slide in the Stanford iOS 9 course here [this video] , he is creating a new UIView with two initializers (one if the UIView was created from storyboard, and one if it was created in code). The following code is written at the bottom of that particular slide: func setup() {....} //This contains the initialization code for the newly created UIView override init(frame: CGRect) { //Initializer if the UIView was created using code. super.init(frame: frame) setup() } required init(coder aDecoder: NSCoder) { //Initializer if UIView was created in storyboard super.init(coder:aDecoder) setup() } The rule is that you must initialize ALL of your own properties FIRST before you can g