gpt4 book ai didi

iphone - 如何默认选择 UITableViewCell?

转载 作者:IT王子 更新时间:2023-10-29 08:13:15 27 4
gpt4 key购买 nike

我已经创建了一个 UITableView 并希望特定的 UITableViewCell 在加载 View 时显示为选中(蓝色)。

最佳答案

-(void)viewWillAppear:(BOOL)animated {
// assuming you had the table view wired to IBOutlet myTableView
// and that you wanted to select the first item in the first section
[myTableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
animated:NO
scrollPosition:UITableViewScrollPositionTop];
}

我正在使用这种技术来选择两个 UITableViewCells 之一,以便用户知道它会影响表格 View 下方的哪个单元格 UIDatePicker。当您创建新事件并设置日期时,Apple 在日历应用程序中使用了此技术。

关于iphone - 如何默认选择 UITableViewCell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1323474/

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