【发布时间】:2015-04-06 19:36:22
【问题描述】:
我有一个要求,我尝试在视图底部设置 3 个按钮,水平放置,没有任何间隙。我附上了我需要如何显示的屏幕截图和另一个显示它当前显示方式的屏幕截图。
我正在以编程方式使用以下约束来设置它
NSDictionary *views = NSDictionaryOfVariableBindings(btnCreateAccount,btnForgotuserid,btnForgotPassword);
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:btnCreateAccount attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1 constant:0]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[btnCreateAccount][btnForgotuserid(==btnCreateAccount)][btnForgotPassword(==btnCreateAccount)]|" options:NSLayoutFormatAlignAllBottom metrics:nil views:views]];
请帮我解决这个问题
编辑:在 iOS 7 中,查看屏幕截图
谢谢, 维诺德。
【问题讨论】:
-
在界面生成器中这样做是一种选择吗?我知道怎么做...
-
否则,我会将每个按钮的宽度设置为 W,其中 W 是一个度量 - 包含按钮的视图宽度的 1/3。指标:@{@"W":1.0/3.0*buttonsSuperView.width}
标签: ios iphone uibutton xcode6 autolayout