2012-03-06 163 views

回答

0

您可以隨時製作自己的圖片按鈕。選擇類型Custom並選擇圖像作爲您的按鈕。不要忘記選擇突出顯示的圖像以獲得最佳用戶體驗。

0

如果你是指的tableView刪除按鈕,這裏的伎倆,

下面的代表將被稱爲第一當你刷卡的動作,

- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    indexForEdit=indexPath.row; //Store the row index 
    edit=1; 
    [tableView reloadData]; 
} 

然後在的cellForRowAtIndexPath代碼如下,

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
//Create a custom cell 
if((indexPath.row==indexForEdit)&&(edit==1)) 
    { 
     edit=0; 
     UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
     //Set frame 
     [customButton setTitle:@"Delete" forState:normal]; 
     [customButton setBackgroundColor:[UIColor grayColor]]; 
     [cell.contentView addSubview:customButton]; 
    } 
}