0
如何更改ios 5.0的xcode4.2中的刪除按鈕樣式?如何更改刪除按鈕樣式?
如何更改ios 5.0的xcode4.2中的刪除按鈕樣式?如何更改刪除按鈕樣式?
您可以隨時製作自己的圖片按鈕。選擇類型Custom
並選擇圖像作爲您的按鈕。不要忘記選擇突出顯示的圖像以獲得最佳用戶體驗。
如果你是指的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];
}
}
什麼刪除按鈕樣式? – BoltClock 2012-03-06 02:17:38
EditTable刪除按鈕樣式我想! – Bala 2012-03-06 04:55:40