Iphone DTGridView不与UILabel交互
我将DTGridView与DTGridViewCell的一个子类一起使用,该子类带有UILabel和UITextField,以执行就地单元格编辑。在UITableView中,这个想法对我很有效,如下所示:Iphone DTGridView不与UILabel交互,iphone,cocoa-touch,uitableview,dtgridview,Iphone,Cocoa Touch,Uitableview,Dtgridview,我将DTGridView与DTGridViewCell的一个子类一起使用,该子类带有UILabel和UITextField,以执行就地单元格编辑。在UITableView中,这个想法对我很有效,如下所示: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { EditableDetailCell *cell = (EditableDetailCe
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
EditableDetailCell *cell = (EditableDetailCell *)[tableView cellForRowAtIndexPath:indexPath];
[[cell textField] setFrame:CGRectMake(8, 0, cell.frame.size.width, cell.frame.size.height)];
[[cell textField] becomeFirstResponder];
[[cell mylabel] setText: nil];
}
文本消失,文本字段出现。同样的事情对我来说不适用
- (void)gridView:(DTGridView *)agridView selectionMadeAtRow:(NSInteger)rowIndex
column:(NSInteger)columnIndex
{
cell textField] setFrame:CGRectMake(8, 0, cell.frame.size.width, cell.frame.size.height)];
[[cell textField] becomeFirstResponder];
[[cell label] setText: nil];
}
有人能帮我吗?非常感谢。我的问题有点小问题。我做的第二个代码 MyCustomCell*cell=MyCustomCell*[aGridView cellInfoForRow:rowIndex column:columnIndex] 在我更改单元格之前。这是对我第一个问题的回答。但现在我有第二个问题。如果我滚动掉所选单元格,然后又返回显示,那么重复使用的单元格会显示有问题的内容。示例:textField不再成为第一响应者,未选择单元格,并且自定义单元格绘制在不同的单元格中。我如何解决这些问题