Section 1

Preview this deck

draw()?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (21)

Section 1

(21 cards)

draw()?

Front

- repositions / resizes contents of a view - doesn't act on subviews - should be triggered, not called

Back

setNeedsDisplay()?

Front

- async func scheduling a draw() on a view - usually triggered by any UI updates on a view - to trigger in response to a non-UI component, call it in the didSet of that property

Back

updateConstraintsIfNeeded()?

Front

- will trigger updateConstraints() immediately, if required

Back

layoutIfNeeded()?

Front

- synchronous function that triggers an immediate layoutSubviews() of a view, if required

Back

3 Layout phases?

Front

- constraint pass - updateConstraints() - layout pass - layoutSubviews() - display pass - draw()

Back

Point vs pixel?

Front

- pixel is a physical dot of color on the screen - point is more a location on a coordinate grid across the screen, invented because at some point Apple fit 4 times as many pixels onto screens that are the same size

Back

updateConstraints()?

Front

- dynamically changes constraints on a view using Auto Layout - should be triggered, not called - only put dynamic constraints here; static constraints can go in the view's initializer

Back

Cocoa touch?

Front

- UI framework for iOS - includes Core Data, Core Animation, UIKit, Foundation

Back

setNeedsLayout()?

Front

- least expensive way to trigger layoutSubviews() - async function that will schedule a layoutSubviews() on a view - use to invalidate the layouts of multiple views, all in one place, upon the next update cycle

Back

Layout cycle methods that trigger immediate updates?

Front

- layoutIfNeeded - updateConstraintsIfNeeded

Back

Triggers for layoutSubviews()?

Front

- resizing view - adding subview - scrolling - rotating - updating constraint

Back

Layout cycle methods that schedule updates?

Front

- setNeedsLayout - setNeedsDisplay - setNeedsUpdateConstraints - invalidateIntrinsicContentSize

Back

layoutSubviews()?

Front

- repositions / resizes view and subviews - can be overridden for precise layout of subviews - expensive - recursively calls itself on all subviews - should be triggered, not called

Back

Foundation?

Front

- data management tools, like SQLite - object wrappers for primitive types, like NSInteger, NSString - notification mechanisms, like event dispatching

Back

Run loop?

Front

- event processing loop - user interactions are added to event queue - Application handles these events, dispatches them to other objects based on handlers for that input - handlers call code written code - when all code returns, control returns to main run loop (this is the update cycle) - each thread has a run loop object

Back

viewDidLayoutSubviews()?

Front

- triggered by completion of layoutSubviews() - should contain any logic that depends on layout and sizing so you can use the most updated values

Back

invalidateIntrinsicContentSize()?

Front

- sets flag indicating that a view's intrinsicContentSize is stale ands need recalculation (via updateConstraints) on next layout pass - intrinsicContentSize - natural size of the view given its contents and constraints

Back

UIWindow?

Front

- blank container for all UIViews - plays a role in the delivery of touch events - usually only one, unless app involves display of another UIWindow on an external display

Back

setNeedsUpdateConstraints()?

Front

- schedules updateConstraints() on next update cycle

Back

Update cycle?

Front

- the point in the run loop at which control returns to the main run loop after handler code returns - point at which layout phases occur

Back

Layout cycle methods that implement updates?

Front

- layoutSubviews - draw - updateConstraints

Back