2
我試圖給一個按鈕一個鬱悶的樣子,並實現我需要按下按鈕時的標題。我認爲contentEdgeInsets是我需要的,但我不知道如何根據按鈕狀態設置不同的值。setContentEdgeInsets爲UIButton的不同狀態?
這工作:
introButton.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 0);
然而,這並不:
[introButton setContentEdgeInsets:UIEdgeInsetsMake(0, 12, 0, 0) forState:UIControlStateNormal];
// warning: 'UIButton' may not respond to '-setContentEdgeInsets:forState:'
謝謝。我並不確信,因爲我在應用程序的其他地方看到了有關工作代碼的警告。我會研究一下UIButton。 – Alan 2011-01-21 17:27:31