【发布时间】:2014-08-11 20:49:21
【问题描述】:
我有一个这样的 UIButton:
UIButton *inviteButton = [UIButton buttonWithType:UIButtonTypeSystem];
[inviteButton setTitle:@"Invite" forState:UIControlStateNormal];
[inviteButton.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:(14.0)]];
[inviteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
如何获取它的高度和宽度以便设置它的框架?
如果我这样做:
float width = inviteButton.frame.size.width;
那么宽度总是为零。
我希望按钮在我创建的视图中右对齐。
【问题讨论】: