2010-05-28 51 views
4

我有一個表視圖,我想提出一個標籤上的每個單元格的右邊,所以在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath我有這樣的UIButtonTypeRoundedRect作爲accessoryView的

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
button.titleLabel.text = @"title"; 
cell.accessoryView = button; 

然而一些代碼,按鈕沒有顯示在所有。有人知道爲什麼 我相信,該聲明是正確的,因爲如果我

UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 

隨後出現的按鈕,這讓我覺得圓角矩形也應該出現更換按鈕聲明。

回答

7

嘗試檢查按鈕的frame是否等於CGRectZero,如果是,請將其設置爲適當的值。

相關問題