UIStackView() vs UIStackView(frame: .zero) initialiser

Viewed 76

I would like to ask about the difference between UIStackView() and UIStackView(frame: .zero) initialisers.

I would like to know which one of the two is triggered by UIStackView() by default.

@interface UIStackView : UIView

- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

Thank you so much.

1 Answers

There is no difference, the convenience UIView initializer without parameters calls UIView(frame: .zero).

The init(coder:) initializer is used only when the view is decoded from a xib/storyboard.

Related