We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(void)viewDidLoad { [super viewDidLoad];
UILabel *label1 = [UILabel new]; UILabel *label2 = [UILabel new]; label1.text = @"Some long text!!!"; label2.text = @"ABC";
OAStackView *sv = [[OAStackView alloc] initWithArrangedSubviews:@[label1, label2]]; sv.translatesAutoresizingMaskIntoConstraints = NO; sv.axis = UILayoutConstraintAxisHorizontal; sv.alignment = OAStackViewAlignmentTop; sv.distribution = OAStackViewDistributionEqualSpacing;
[self.view addSubview:sv];
[sv.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:50].active = YES; [sv.leftAnchor constraintEqualToAnchor:self.view.leftAnchor constant:10].active = YES; [sv.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-10].active = YES;
UILabel *label3 = [UILabel new]; UILabel *label4 = [UILabel new]; label3.text = @"Some long text!!!"; label4.text = @"ABC";
UIStackView *sv2 = [[UIStackView alloc] initWithArrangedSubviews:@[label3, label4]]; sv2.translatesAutoresizingMaskIntoConstraints = NO; sv2.axis = UILayoutConstraintAxisHorizontal; sv2.alignment = OAStackViewAlignmentTop; sv2.distribution = OAStackViewDistributionEqualSpacing;
[self.view addSubview:sv2];
[sv2.topAnchor constraintEqualToAnchor:sv.bottomAnchor constant:50].active = YES; [sv2.leftAnchor constraintEqualToAnchor:self.view.leftAnchor constant:10].active = YES; [sv2.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-10].active = YES; }
The codes are very similar, one for OAStackView, one for UIStackView. The result is different, the label1 get clipped and label3 is fine.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(void)viewDidLoad {
[super viewDidLoad];
UILabel *label1 = [UILabel new];
UILabel *label2 = [UILabel new];
label1.text = @"Some long text!!!";
label2.text = @"ABC";
OAStackView *sv = [[OAStackView alloc] initWithArrangedSubviews:@[label1, label2]];
sv.translatesAutoresizingMaskIntoConstraints = NO;
sv.axis = UILayoutConstraintAxisHorizontal;
sv.alignment = OAStackViewAlignmentTop;
sv.distribution = OAStackViewDistributionEqualSpacing;
[self.view addSubview:sv];
[sv.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:50].active = YES;
[sv.leftAnchor constraintEqualToAnchor:self.view.leftAnchor constant:10].active = YES;
[sv.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-10].active = YES;
UILabel *label3 = [UILabel new];
UILabel *label4 = [UILabel new];
label3.text = @"Some long text!!!";
label4.text = @"ABC";
UIStackView *sv2 = [[UIStackView alloc] initWithArrangedSubviews:@[label3, label4]];
sv2.translatesAutoresizingMaskIntoConstraints = NO;
sv2.axis = UILayoutConstraintAxisHorizontal;
sv2.alignment = OAStackViewAlignmentTop;
sv2.distribution = OAStackViewDistributionEqualSpacing;
[self.view addSubview:sv2];
[sv2.topAnchor constraintEqualToAnchor:sv.bottomAnchor constant:50].active = YES;
[sv2.leftAnchor constraintEqualToAnchor:self.view.leftAnchor constant:10].active = YES;
[sv2.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:-10].active = YES;
}
The codes are very similar, one for OAStackView, one for UIStackView. The result is different, the label1 get clipped and label3 is fine.
The text was updated successfully, but these errors were encountered: