按下单元格(didSelectRowAtIndexPath)时,我希望将单元格复制到视图中。然后我将有可能移动视图,从UITableView分离。
是否可以复制一行代码,而不是
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [self.tasksTable cellForRowAtIndexPath:indexPath];
UIView* copyOfTheCell = [[UIView alloc]initWithFrame:cell.frame];
copyOfTheCell.backgroundColor = [UIColor blueColor];
UILabel* title = cell.textLabel;
[copyOfTheCell addSubview:title];
[self.view addSubview:copyOfTheCell];
}