c_cpp iOS类别方法将约束更改为UIView
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp iOS类别方法将约束更改为UIView相关的知识,希望对你有一定的参考价值。
#import "UIView+ChangeConstraint.h"
@implementation UIView(ChangeConstraint)
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (void)constraintChangeHeight:(CGFloat)fH
{
for (NSLayoutConstraint *lc in self.constraints) {
if((lc.firstAttribute == NSLayoutAttributeHeight)&&(lc.firstItem == self)&&(lc.secondItem == NSLayoutAttributeNotAnAttribute))
{
lc.constant = fH;
}
}
}
@end
#import <UIKit/UIKit.h>
@interface UIView(ChangeConstraint)
- (void)constraintChangeHeight:(CGFloat)fH;
@end
以上是关于c_cpp iOS类别方法将约束更改为UIView的主要内容,如果未能解决你的问题,请参考以下文章