OGeek|极客世界-中国程序员成长平台

标题: ios - 检测插入的单元格,然后让它成为FirstResponder [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 03:56
标题: ios - 检测插入的单元格,然后让它成为FirstResponder

对于我的自定义单元格,举个简单的例子,我只有一个 UITextField,有没有办法让 刚刚插入的单元格 becomeFirstResponder insertRowsAtIndexPaths ?

我需要一种方法来检测这一点,以便在插入后和插入动画结束时成为第一响应者。

有什么想法,甚至接近吗?

谢谢



Best Answer-推荐答案


像这样的东西??

- (void) insertRows
{
    .
    .
    .

    [tableView beginUpdates];
    [tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationRight];
    [tableView endUpdates];

    NSIndexPath p = [indexPaths lastObject];

    MyCustomCell *cell = [cellForRowAtIndexPath:p];
    [cell.textField becomeFirstResponder];
}

关于ios - 检测插入的单元格,然后让它成为FirstResponder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15926205/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4