swift - 以编程方式增加 indexPath
问题描述
如何以var
编程方式增加 indexPath 类型的?例如,当前 indexPath 是 [0, 44],我希望在特定操作后 indexPath 是 [0,45]?
解决方案
由于您正在使用集合视图,因此您似乎想要增加该item
属性。
someIndexPath.item += 1
如果需要,您还可以IndexPath
在旧的基础上创建一个新的:
let newIndexPath = IndexPath(item: oldIndexPath.item + 1, section: oldIndexPath.section)
推荐阅读
- python - Incosistent QLabels with QPixmaps resizing behavior inside horizontal layout while keeping aspect ratio of images
- r - Changing periodicity of panel data in R
- sql - 从值中删除小数
- sql-server - MSSQL: Date is greater than specific date or is null
- schema.org - Make 'Review' belong to 'Product' in Microdata
- c# - 通过ajax将文件发送到另一个动作mvc5 c#
- field - 如何在 Graylog 中添加自定义字段?
- dll - 64 位 Simulink 不生成 64 位 DLL
- javascript - What does a colon within an map call mean in Javascript
- ruby-on-rails - How to add to an existing hash in a instance variable in a better way?