Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在没有.xib的脚本中创建外部UITableViewCell_Ios_Uitableview_Storyboard_Uistoryboard - Fatal编程技术网

Ios 在没有.xib的脚本中创建外部UITableViewCell

Ios 在没有.xib的脚本中创建外部UITableViewCell,ios,uitableview,storyboard,uistoryboard,Ios,Uitableview,Storyboard,Uistoryboard,我有两个不同的TableVC和通用单元格。我可以将单元格从一个复制到另一个,但是否有其他方法将其存档?我不想使用.xib,这里是你可以做的事情,如果你想拥有相同的单元格。我只是简单的截图 -(void)copyCell { UITableViewCell * aCell = [_tblView cellForRowAtIndexPath:[_tblView indexPathForSelectedRow]]; UIGraphicsBeginImageContext(aCell.

我有两个不同的TableVC和通用单元格。我可以将单元格从一个复制到另一个,但是否有其他方法将其存档?我不想使用.xib,这里是你可以做的事情,如果你想拥有相同的单元格。我只是简单的截图

-(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,单元格设计