Convert NSInteger to NSIndexpath

后端 未结 4 875
夕颜
夕颜 2020-12-14 05:55

Basically I am storing an index of an array in a NSInteger. I now need it as an NSIndexpath, I\'m struggling to see and find a way to convert my NSInteger to NSIndexpath so

4条回答
  •  失恋的感觉
    2020-12-14 06:33

    If you need a NSIndexPath for a UITableView, you can use indexPathForRow:inSection: (reference). Index paths passed to table view must contain exactly two indices specifying the section and row. An index path created with indexPathWithIndex: only contains one index and won't work with a table view.

提交回复
热议问题