IOS中关于TableView必须实现的步骤和方法

来源:互联网 发布:linux 串口驱动 编辑:程序博客网 时间:2024/05/18 13:09

关于TableView 

1.调用的时候注意设置2个委托,<UITableViewDelegate,UITableViewDataSource>

2.2个必须实现的方法,行数和行的路径:numberOfRowsInSection,cellForRowAtIndexPath,

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

3.选择行的方法,didSelectRowAtIndexPath

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

4.删除行的方法 :

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath