2016-04-28 13 views

Odpowiedz

17

Wartości te są up-to-date, jak z Xcode 7.3.


Interfejs Builder domyślne wartości priorytetowe:

Kiedy przeciągając komponent do konstruktora Interface, można uzyskać następujące priorytety. Uwaga: (250,750) oznacza 250 poziomą i 750 pionową.

+-------------------------+---------------+------------------------------+ 
|   Object   | Hugging (H,V) | Compression Resistance (H,V) | 
+-------------------------+---------------+------------------------------+ 
| UIActivityIndicatorView | 750,750  | 750,750      | 
| UIButton    | 250,250  | 750,750      | 
| UIDatePicker   | 250,250  | 750,750      | 
| UIImageView    | 251,251  | 750,750      | 
| UILabel     | 251,251  | 750,750      | 
| UIPageControl   | 250,250  | 750,750      | 
| UIPickerView   | 250,250  | 750,750      | 
| UIProgressView   | 250,750  | 750,750      | 
| UIScrollView   | 250,250  | 750,750      | 
| UISearchBar    | 250,250  | 750,750      | 
| UISegmentedControl  | 250,250  | 750,750      | 
| UISlider    | 250,250  | 750,750      | 
| UIStepper    | 750,750  | 750,750      | 
| UISwitch    | 750,750  | 750,750      | 
| UITabBar    | 250,250  | 750,750      | 
| UITextField    | 250,250  | 750,750      | 
| UITextView    | 250,250  | 750,750      | 
| UIToolbar    | 250,250  | 750,750      | 
| UIView     | 250,250  | 750,750      | 
+-------------------------+---------------+------------------------------+ 

Ocena:

  • Wszystkie obiekty mają 750,750 jako ich Content Compression Resistance Priorytetu.
  • Większość ma 250,250 jako ich Content Hugging Priority.
  • UIImageView i UILabel oba mają 251,251 jako ich Content Hugging Priority.
  • UIActivityIndicatorView, UIStepper i UISwitch mieć 750,750 jako ich Content tulenie Priorytetu.
  • UIProgressView ma 250,750 jako Content Hugging Priority.

programowe domyślne wartości priorytetowe:

Podczas tworzenia obiektu programowo (np UIButton()), można uzyskać następujące priorytety.

+-------------------------+---------------+------------------------------+ 
|   Object   | Hugging (H,V) | Compression Resistance (H,V) | 
+-------------------------+---------------+------------------------------+ 
| UIActivityIndicatorView | 750,750  | 750,750      | 
| UIButton    | 250,250  | 750,750      | 
| UIDatePicker   | 750,750  | 750,750      | 
| UIImageView    | 250,250  | 750,750      | 
| UILabel     | 250,250  | 750,750      | 
| UIPageControl   | 750,750  | 750,750      | 
| UIPickerView   | 750,750  | 750,750      | 
| UIProgressView   | 250,750  | 750,750      | 
| UIScrollView   | 250,250  | 750,750      | 
| UISearchBar    | 250,750  | 750,750      | 
| UISegmentedControl  | 250,750  | 750,750      | 
| UISlider    | 250,750  | 750,750      | 
| UIStepper    | 750,750  | 750,750      | 
| UISwitch    | 750,750  | 750,750      | 
| UITabBar    | 250,750  | 750,750      | 
| UITextField    | 250,250  | 750,750      | 
| UITextView    | 250,250  | 750,750      | 
| UIToolbar    | 250,750  | 750,750      | 
| UIView     | 250,250  | 750,750      | 
+-------------------------+---------------+------------------------------+ 

Ocena:

  • Istnieje Content przytulenia Priorytet różnice pomiędzy IB instancji obiektów i programowo instancji obiektów dla następujących obiektów: UIDatePicker, UIImageView, UILabel, UIPageControl, UIPickerView, UISearchBar, UISegmentedControl, UISlider, UITabBar i UIToolbar.

Programowa Stałe

+----------------------------------+-------+ 
|    Constant    | Value | 
+----------------------------------+-------+ 
| UILayoutPriorityRequired   | 1000 | 
| UILayoutPriorityDefaultHigh  | 750 | 
| UILayoutPriorityDefaultLow  | 250 | 
| UILayoutPriorityFittingSizeLevel | 50 | 
+----------------------------------+-------+ 

Po dodaniu ograniczenie (zarówno poprzez interfejs Builder lub programowo), jego domyślnym priorytetem jest 1000.