我試圖爲我以編程方式創建的自定義按鈕設置標題。按鈕的圖像和框架很好,但標題沒有。我無法真正想到這段代碼有什麼問題,所以任何幫助都是有好處的!UIButton wierdness:無法爲自定義按鈕類型設置標題
self.helpButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.helpButton setFrame:CGRectMake(113.0, 685.5, 73.0, 40.0)];
UIImage *helpImg = [UIImage imageNamed:@"11_HelpCancel_Up.png"];
[self.helpButton setImage:helpImg
forState:UIControlStateNormal];
[self.helpButton setTitle:@"Help" forState:UIControlStateNormal];
[self.helpButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// [self.helpButton setFont:[UIFont boldSystemFontOfSize:14.0]];
[self.view addSubview:self.helpButton];
感謝,
Teja公司。