UITableViewCell的附件及代理方法

来源:互联网 发布:aveva软件购买 编辑:程序博客网 时间:2024/06/05 04:04

下面程序,我们设置了UITableViewCell的附件类型,该控件支持一下的控件,除此之外,下面还是实现了代理方法,当用户点击指定表格的右边的附件按钮是将会激发该方法;

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static NSString *cellID =@"cell";    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];    if (cell == nil) {        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];    }    NSInteger rowNo = indexPath.row;        cell.textLabel.text = books[rowNo];    cell.detailTextLabel.text = [details objectAtIndex:rowNo];    ////    cell.accessoryType = UITableViewCellAccessoryDetailButton;//    cell.accessoryType = UITableViewCellAccessoryCheckmark;    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;            return cell;}//UITableVeiwDelegate定义的方法,当表格行右边的附件按钮被单击是激发该方法-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{    EditViewController *editvc = [[EditViewController alloc]init];    NSInteger rowNoo = indexPath.row;    editvc.rowNo = rowNoo;    editvc.book = [books objectAtIndex:rowNoo];    editvc.details = [details objectAtIndex:rowNoo];    [self.navigationController pushViewController:editvc animated:YES];    }


3 0