在实例化它时如何设置它的大小UIButton
,准备好使用它NSLayoutConstraint
?
代码:
UIButtonRaisedSilver *loginButton = [UIButtonRaisedSilver buttonWithType:UIButtonTypeCustom];
[loginButton addTarget:self action:@selector(login) forControlEvents:UIControlEventTouchUpInside];
[loginButton setTitle:@"Log in" forState:UIControlStateNormal];
NSDictionary *views = @{@"tableView" : self.tableView, @"loginButton": loginButton, @"signupButton": signupButton};
[NSLayoutConstraint constraintsWithVisualFormat:@"V:[tableView]-50-[loginButton()]"
options:NSLayoutFormatAlignAllCenterX
metrics:nil
views:views];