0
我想在我的UIButton CGRect中心(x轴和y轴)这个+符号,但是它一直向下推进y轴。在其框架中居中放置一个UIButton标题
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeSystem];
[aButton setTitle:@"+" forState:UIControlStateNormal];
[aButton.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:(40.0)]];
[aButton setBackgroundColor:[UIColor grayColor]];
[aButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[aButton setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
aButton.layer.cornerRadius = 25.0;
aButton.frame = CGRectMake(75.0, 100.0, 50.0, 50.0);
喔,你如何移动的标签。添加一个UILabel然后选择它的中心起源? – cdub
一个按钮是非常可定制的。看看文档... – matt
我感谢一吨 – cdub