如何让UITableView显示当前项目?

时间:2021-02-22 17:23:47

I have an array filled with dictionaries. Each dictionary have strings like title, info and date. Cells in the table are arranged by the date from the dictionary.

我有一个充满字典的数组。每个字典都有标题,信息和日期等字符串。表格中的单元格按字典中的日期排列。

What should I do to make it show the cell as active if the date field in dictionary=current date or closest date in the future?

如果字典中的日期字段=当前日期或将来最接近的日期,我该怎么做才能使单元格显示为活动状态?

Thanks in advance! I'd really appreciate your help!

提前致谢!我真的很感谢你的帮助!

1 个解决方案

#1


0  

I am assuming that you want to somehow highlight the current date. A simple thing would be to select the cell using [cell setSelected:YES animated:YES]. An other thing would be setting the accessoryType to UITableViewCellAccessoryCheckmark ([cell setAccessoryType:UITableViewCellAccessoryCheckmark]). If you don't like these approaches, you can still create a custom UITableViewCell with support of some sort of highlighting, like showing an arrow in the cell.

我假设您想以某种方式突出显示当前日期。一个简单的事情是使用[cell setSelected:YES animated:YES]选择单元格。另一件事是将accessoryType设置为UITableViewCellAccessoryCheckmark([cell setAccessoryType:UITableViewCellAccessoryCheckmark])。如果你不喜欢这些方法,你仍然可以创建一个支持某种突出显示的自定义UITableViewCell,比如在单元格中显示一个箭头。

#1


0  

I am assuming that you want to somehow highlight the current date. A simple thing would be to select the cell using [cell setSelected:YES animated:YES]. An other thing would be setting the accessoryType to UITableViewCellAccessoryCheckmark ([cell setAccessoryType:UITableViewCellAccessoryCheckmark]). If you don't like these approaches, you can still create a custom UITableViewCell with support of some sort of highlighting, like showing an arrow in the cell.

我假设您想以某种方式突出显示当前日期。一个简单的事情是使用[cell setSelected:YES animated:YES]选择单元格。另一件事是将accessoryType设置为UITableViewCellAccessoryCheckmark([cell setAccessoryType:UITableViewCellAccessoryCheckmark])。如果你不喜欢这些方法,你仍然可以创建一个支持某种突出显示的自定义UITableViewCell,比如在单元格中显示一个箭头。