Ios 在没有.xib的脚本中创建外部UITableViewCell
我有两个不同的TableVC和通用单元格。我可以将单元格从一个复制到另一个,但是否有其他方法将其存档?我不想使用.xib,这里是你可以做的事情,如果你想拥有相同的单元格。我只是简单的截图Ios 在没有.xib的脚本中创建外部UITableViewCell,ios,uitableview,storyboard,uistoryboard,Ios,Uitableview,Storyboard,Uistoryboard,我有两个不同的TableVC和通用单元格。我可以将单元格从一个复制到另一个,但是否有其他方法将其存档?我不想使用.xib,这里是你可以做的事情,如果你想拥有相同的单元格。我只是简单的截图 -(void)copyCell { UITableViewCell * aCell = [_tblView cellForRowAtIndexPath:[_tblView indexPathForSelectedRow]]; UIGraphicsBeginImageContext(aCell.
-(void)copyCell
{
UITableViewCell * aCell = [_tblView cellForRowAtIndexPath:[_tblView indexPathForSelectedRow]];
UIGraphicsBeginImageContext(aCell.frame.size);
[aCell.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *aCellImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView * imageView = [[UIImageView alloc] initWithImage:aCellImage];
imageView.frame = CGRectMake(aCell.frame.origin.x, aCell.frame.origin.y-offset, aCell.frame.size.width, aCell.frame.size.height);
[self.view addSubview:imageView]; --->> change the self.view to your next tableView cell
}
您的意思是复制单元格图像、标签中的内容吗?还是其他单元格的设计框大小、颜色?@Bejibun,单元格设计