iOS

Auto Layout & Constraints

Auto Layout, constraints, stack views, priorities, content hugging, compression resistance

24 mülakat soruları·
Mid-Level
1

What is Auto Layout in iOS?

Cevap

Auto Layout is a constraint-based system that automatically calculates view positions and sizes based on their dependencies. It enables creating adaptive interfaces without manually managing positions. Auto Layout is essential for supporting multiple screen sizes and orientations.

2

What is the role of the translatesAutoresizingMaskIntoConstraints property?

Cevap

This property controls whether the autoresizing mask is converted into Auto Layout constraints. By default it is true, which can create conflicts with explicit constraints. When using Auto Layout, setting it to false is required to avoid warnings and conflicts.

3

What is the difference between NSLayoutConstraint and NSLayoutAnchor?

Cevap

NSLayoutConstraint is the classic dictionary-based API, more verbose and error-prone. NSLayoutAnchor is a modern, type-safe API using methods to create constraints. NSLayoutAnchor provides better readability and compile-time error detection.

4

What is the difference between `constraintEqualToAnchor` and `constraintEqualToConstant`?

5

Why is the `contentHuggingPriority` property important in Auto Layout?

+21 mülakat soruları

Bir sonraki mülakatın için iOS'de uzmanlaş

Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.

Ücretsiz başla