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