【发布时间】:2014-03-24 05:03:01
【问题描述】:
我已经尝试了很多设置 UITextView 的自动布局约束。但是当我运行时,我得到空白屏幕。我在 UIButton 中尝试了相同的方法,效果很好!!!!!
是否有任何属性要设置为 UITextView 分配约束????
UITextView *text1;
text1=[[UITextView alloc]initWithFrame:CGRectMake(50, 100, 100, 30)];
[text1 setBackgroundColor:[UIColor blueColor]];
set.text1=@"asjdgajsdbasbfbsdfbsdbfbsd";
[text1 sizeToFit];
set.translatesAutoresizingMaskIntoConstraints=NO;
[self.view addSubview:text1];
NSLayoutConstraint *constraint;
constraint = [NSLayoutConstraint constraintWithItem:text1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0f constant:1.f];
[self.view addConstraint:constraint];
【问题讨论】:
标签: ios uiview ios7 uitextview nslayoutconstraint