简体   繁体   English

选择TextView时,ios Tableview单元格消失

[英]ios Tableview cell disappears when Selecting TextView

I have a tableview that has custom cells in it. 我有一个具有自定义单元格的表视图。 The section header on the cell has a selectable textview. 单元格上的节标题具有可选的textview。

When you double tap and select the textview then tap away from it... the cell literally disappears. 当您双击并选择文本视图时,再从其上点击…,单元格就会消失。 But when I scroll completely so that the cell is out of visibility and go back then scroll back... the cell comes back. 但是,当我完全滚动以使该单元格不在可见范围内,然后返回然后再滚动...时,该单元格会返回。

Very confused as to why this is happening. 对于为什么会这样非常困惑。 Does anyone have any idea what would cause this issue??? 有谁知道会导致这个问题的原因???

Issue is specific to the Table view header section, if I have selectable textview in the other cells and tap away the cell doesn't disappear. 问题是特定于表格视图标题部分的,如果我在其他单元格中有可选的textview并轻按,则该单元格不会消失。

I think you are designed the View for header as a table view cell. 我认为您是将表头的View设计为表格视图单元格。 The disappearing issue is may be due to two reasons 问题的消失可能是由于两个原因

1.Please check the tableview and cell views scope you declared.If it is weak please make it as strong. 1.请检查您声明的表视图和单元格视图范围,如果弱,请使其强。

2.I will give ua sample code you need to declare in view for header delegate If you returned cell instead of uiview it may happen.Please verify that one also. 2.我将提供一个示例代码,您需要在视图中为标头委托声明此代码。如果您返回单元格而不是uiview,则可能会发生。

static NSString *CellIdentifier = @"QuizCreation2HeaderTableViewCell";

QuizCreation2HeaderTableViewCell* sectionHeaderCell = (QuizCreation2HeaderTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];


UIView * headerView = [[UIView alloc] initWithFrame:sectionHeaderCell.frame];
[headerView addSubview:sectionHeaderCell];

return headerView;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM