Skip to content

Conversation

cntrump
Copy link
Contributor

@cntrump cntrump commented Nov 21, 2018

    UIView *v = [[UIView alloc] initWithFrame:CGRectZero];
    v.backgroundColor = UIColor.brownColor;
    [self.view addSubview:v];
    [v mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];

    UILayoutGuide *guide = [[UILayoutGuide alloc] init];
    [self.view addLayoutGuide:guide];
    [guide.widthAnchor constraintEqualToConstant:10].active = YES;
    [guide.heightAnchor constraintEqualToConstant:0].active = YES;
    [guide.centerYAnchor constraintEqualToAnchor:v.centerYAnchor].active = YES;
    [guide.leftAnchor constraintEqualToAnchor:v.rightAnchor constant:0].active = YES;

    UIView *v2 = [[UIView alloc] initWithFrame:CGRectZero];
    v2.backgroundColor = UIColor.orangeColor;
    [self.view addSubview:v2];
    [v2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(guide.mas_right);
        make.centerY.mas_equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];

@cntrump
Copy link
Contributor Author

cntrump commented May 31, 2021

#594

@cntrump cntrump closed this May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant