0
不可見我增加了圓形的UIButton是這樣的:當按鈕被顯示文本在圓的UIButton的iOS
-(void)addInfoButton
{
UIButton *pButton = [UIButton buttonWithType:UIButtonTypeCustom];
[pButton addTarget:self
action:@selector(infoButtonDidTap:)
forControlEvents:UIControlEventTouchUpInside];
pButton.frame = [self getInfoButtonFrame];
pButton.clipsToBounds = NO;
//half of the width
pButton.layer.cornerRadius = BUTTON_HEIGHT/2.0f;
pButton.layer.borderColor = self.tintColor.CGColor;
pButton.layer.borderWidth = 2.0f;
pButton.titleLabel.text = @"F";
pButton.titleLabel.textColor = self.tintColor;
pButton.titleLabel.textAlignment = NSTextAlignmentCenter;
self.filterInfoButton = pButton;
[self addSubview:pButton];
}
文本「F」是不可見的。可能是什麼原因?
編輯: 將角半徑設置爲0時,文字可見。但是,那麼按鈕不是圓形的。
你能看到按鈕嗎?按鈕框是什麼? –
是的,我可以完全看到按鈕..按鈕的高度和寬度是每個44 – StudentX
「可能是什麼原因?」各種各樣的東西 - 例如,你試圖用什麼顏色來表現文字顏色? – TwoStraws