ios - 如何获取Masonry为UIView声明的高度约束?

标签 ios objective-c uiview autolayout masonry

例如,我通过 Masonry 为 UIView 声明了一些约束:

[replyTextView mas_makeConstraints:^(MASConstraintMaker *make) {
  make.height.mas_equalTo(44);
  make.left.right.bottom.equalTo(self.contentView);
}];

如何获得 replyTextView 的高度限制?

我知道我可以使用 replyTextView.constraints 获取所有约束,但我不知道如何告诉它们。

最佳答案

如文档中所述:

   // in public/private interface
@property (nonatomic, strong) MASConstraint *heightConstraint;

...

// when making constraints
[view1 mas_makeConstraints:^(MASConstraintMaker *make) {
    self.heightConstraint =  make.height.mas_equalTo(44);
}];

...
// then later you can call
[self.heightConstraint uninstall];

关于ios - 如何获取Masonry为UIView声明的高度约束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32461366/

相关文章:

android - 为 ios 和 android 删除 phonegap 中的启动画面

ios - 将函数传递给变量,以便稍后调用

ios - 通过函数初始化实例变量

arrays - TableView 没有结果错误?

ios - 无法解析调试映射

jquery - 手机上传选择相机

objective-c - 为 iOS 创建静态库值得吗?

ios - Objective-C:setValue:Key:xposition的值

ios - 选择时 View 从 UITableViewCell 中消失

ios - 带有 CAShapeLayer 的 UIView 不显示 CAGradientLayer