gpt4 book ai didi

ios - Masonry.unrecognized 选择器发送到实例

转载 作者:行者123 更新时间:2023-11-28 23:58:19 26 4
gpt4 key购买 nike

  UIView *v2 = ({
UIView *view = [UIView new];
[self.view addSubview:view];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(50, 50));
make.left.equalTo(v1.mas_right);
make.top.equalTo(v1.mas_bottom);
}];
view.backgroundColor = [UIColor blueColor];
view.layoutMargins = UIEdgeInsetsMake(-20, -20, -20, -20);
view;
});


UIView *v3 = ({
UIView *view = [UIView new];
[self.view addSubview:view];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(50, 50));
make.centerY.equalTo(v2);
make.left.equalTo(v2.mas_rightMargin);
// make.left.equalTo(v2.mas_right);
}];
view.backgroundColor = [UIColor redColor];
view;
});

如您所见,我正在使用 Masonry 来创建 UI。

这段代码有错误。

-[UIView mas_rightMargin]: unrecognized selector sent to instance 0x7fdfa640cf80'

如果我将 make.left.equalTo(v2.mas_rightMargin); 更改为 make.left.equalTo(v2.mas_right);;,它不会崩溃。

最佳答案

只需将 Pods -> Masonry -> iOS Deployment Target 设置为您项目的目标即可。这是截图,希望对你有帮助...

image

关于ios - Masonry.unrecognized 选择器发送到实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50481452/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com