一、新增uitableviewcell為自己設計的風格
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath*)indexpath
cell.
selectionstyle
= uitableviewcellselectionstylenone;
tqdownitem *item = [[tqdownlist
shareinstance] taskatindex:indexpath.row];
cell.downitem = item;
return cell;
}else
if(indexpath.section == 1)
backcell.
selectionstyle
= uitableviewcellselectionstylenone;
tqvideodownitem
*item = [[
tqdownlist
shareinstance] getcurrentbackgroupdowninfo];
if(item)
else
return backcell;}
returnnil; }
二。修改uitableview的footer 和 head
- (uiview *)tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section
returnnil; }
三、允許對cell進行編輯(刪除、拖動等)
-(bool)tableview:(uitableview *) tableview caneditrowatindexpath:(nsindexpath *)indexpath
- (void)setediting:(bool)e animated:(bool)ani
//tableview 中cell選中事件
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath
//編輯tableview 時調整cell view裡的控制項位置
- (void)layoutsubviews
else [
super
layoutsubviews]; }
四、允許cell之間的拖動
- (bool)tableview:(uitableview *)tableview canmoverowatindexpath:(nsindexpath *)indexpath
- (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)sourceindexpath toindexpath:(nsindexpath *)destinationindexpath
UITableView的編輯操作
因為tableview是螢幕的一部分,所以viewcontroll不再繼承uitableviewcontrol,繼而必須加入tableview的委託協議uitableviewdatasource 具體實現 如下 import viewcontroller.h inte ce viewcontroll...
UITableView的移動 刪除操作
uitableview的功能很強大,經常用的如刪除 移動等功能都能非常簡單的實現,現將刪除移動屬性的使用貼出來 pragma mark pragma mark table view data source methods 設定編輯模式 刪除 加入 uitableviewcelleditingstyl...
UITableView 詳細講解
建立 uitableview datatable uitableview alloc initwithframe cgrectmake 0,0,320,420 datatable setdelegate self datatable setdatasource self self.view adds...