自定义cell 且加载 xib 做为模型方法

来源:互联网 发布:php读取chm文件内容 编辑:程序博客网 时间:2024/06/05 16:32


1.0自定义 controller 及 xib, 在创建 cell 是使用 

NSArray *nib = [[NSBundlemainBundle] loadNibNamed:@"Cell"owner:selfoptions:nil];

        cell = [nib objectAtIndex:0];

即可直接使用 xib 的文件.


2.0 点击 cell更改cell内部控件的属性, 需先获取点击的模型

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

{

    Cell *cell = [tableView cellForRowAtIndexPath:indexPath];

    cell.PlayImage.hidden =NO;

    cell.PauseImage.hidden =NO;

    

//    [tableView beginUpdates];

//    [tableView endUpdates];

}


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

{

    Cell *cell = [tableView cellForRowAtIndexPath:indexPath];

    

    cell.PlayImage.hidden =YES;

    cell.PauseImage.hidden =YES;

}






0 0
原创粉丝点击