iOS中uitableview滑動刪除新增按鈕

2021-07-25 08:42:57 字數 1065 閱讀 9051

一:如果我們不新增任何按鈕,直接需要乙個刪除的話,很簡單

-(void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath

}-(nsstring *)tableview:(uitableview *)tableview titlefordeleteconfirmationbuttonforrowatindexpath:(nsindexpath *)indexpath

二:如果我們想在刪除裡面再加一些東西,比如扣扣的詳情,設頂等

-(nsarray

*)tableview:(uitableview *)tableview editactionsforrowatindexpath:(nsindexpath *)indexpath

]; uitableviewrowaction *rowaction2 = [uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault

title:@"詳情" handler:^(uitableviewrowaction * _nonnull action, nsindexpath * _nonnull indexpath) ];

//預設背景顏色都是紅色,我們可以自己再做調整

rowaction2.backgroundcolor =[uicolor graycolor];

nsarray *arr = @[rowaction,rowaction2];

return arr;

}-(void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath

{}

iOS7中UITableView中cell的使用

今天看到很多人提到,在ios7中,使用uitableview的時候,對於cell要注意 cell addsubview usertextfield 這種用法不能再用了,應該使用 cell.contentview addsubview usertextfield 的方式。如某人就遇到這種問題 調查了一...

iOS7中UITableView中cell的使用

分類 ios oc 2013 09 26 15 01 3099人閱讀收藏 舉報 今天看到很多人提到,在ios7中,使用uitableview的時候,對於cell要注意 cell addsubview usertextfield 這種用法不能再用了,應該使用 cell.contentview adds...

IOS控制項UITableView詳解

終於寫到了uitableview,用處最廣的乙個控制項,當然也是要記相當多東西的乙個控制項。首選建立乙個新的專案,並新增乙個mainviewcontroller的class檔案 開啟mainviewcontroller.h檔案 inte ce mainviewcontroller uiviewcon...