【发布时间】:2013-09-25 21:19:58
【问题描述】:
我有 3 个按钮内的视图。我的问题是,如何以编程方式设置resizing mask 或autolayout 以获得此解决方案:
小视图和大视图..
Objective-c 代码:
_button1 = [UIButton buttonWithType:UIButtonTypeCustom];
[_button1 setFrame:CGRectMake(0, 0, self.view.frame.size.width, 70)]; // set a height?!
[_button1 setBackgroundColor:[UIColor colorWithRed:235/255.0f green:235/255.0f blue:235/255.0f alpha:1.0f]];
_button1.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_button2 and_button3 are the same..
如何根据视图高度灵活设置按钮高度?
感谢您的帮助..
【问题讨论】:
-
你可能最好使用 AutoLayout。
-
是的..我如何以编程方式使用自动布局解决问题?
标签: objective-c autoresizingmask