我发现这个代码,一个自定义的UITableViewCell:与自定义的UITableViewCell混淆语法
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"MyCustomCell" owner:nil options:nil];
MyCustomCell *customCell = [[MyCustomCell alloc]init];
MyCustomCell.cellImage = [arrayImages objectAtIndex:indexPath.row];
for (UIView *view in views)
{
if([view isKindOfClass:[UITableViewCell class]])
{
cell = (MyCustomCell *)view;
}
}
}
,我想不通这个特定的部分是如何工作的:cell = (MyCustomCell *)view;
我想改变它为我以前创建MyCustomCell(customCell)的实例...我怎么能这样做?
而我怎么能把它转换成我的MyCustomCell实例的类型呢? – 2012-04-13 20:12:46
@Lucase Pereira:我不知道我跟着你。现在它将'cell'强制转换为'MyCustomCell',如果它确实是'MyCustomCell'的一个实例。 – Josh 2012-04-13 20:14:33