gpt4 book ai didi

iphone - iPhone 中的表格 View 单元格选择

转载 作者:行者123 更新时间:2023-11-29 04:43:23 25 4
gpt4 key购买 nike

当我向上或向下滚动表格 View 时,我得到的表格 View 单元格未被选中。我应该如何在代码中使用以下方法?

[tableview selectRowAtIndexPath:animated:scrollPosition];

最佳答案

我应该如何在代码中使用以下方法?

[tableview selectRowAtIndexPath:animated:scrollPosition];

示例:在表格 View 上添加新单元格并将表格向上滚动到添加的单元格:

NSArray *indexPaths = [NSArray arrayWithObjects: [NSIndexPath indexPathForRow:[self.yourDataSource count]-1 inSection:0],nil];
[self.myTableView beginUpdates];
[self.myTableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
[self.myTableView endUpdates];
[self.myTableView scrollToRowAtIndexPath:indexPaths atScrollPosition:UITableViewScrollPositionTop animated:YES];

关于iphone - iPhone 中的表格 View 单元格选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10026267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com