我是Obj-C的新手。我一直在使用UICollectionView的排序功能。細胞轉移後我正在保存數據。但是NSIndexPath信息並不像我預期的那樣。我不確定在使用indexPathsForVisibleItems時如何訪問索引的一部分。在使用indexPathsForVisibleItems時只獲取NSIndexPath的一部分
NSArray *visible = [self.collectionView indexPathsForVisibleItems];
NSLog(@"These are the visible cells %@", visible);
這將返回這樣NSLogs ....
"<NSIndexPath 0x8a6b7f0> 2 indexes [0, 0]",
"<NSIndexPath 0x8a6d3d0> 2 indexes [0, 2]",
"<NSIndexPath 0x8a6d480> 2 indexes [0, 3]",
"<NSIndexPath 0x889f080> 2 indexes [0, 1]"
我想要得到的數字的第二列。 NSIndex路徑中的0,2,3,1。我確信如果我能夠訪問這些值,我就可以從單元中獲取信息。是否有一個特定的約定或轉換,以獲得0,2,3,1和一個簡單的數組。
謝謝。
哇!正確地粘貼它,它像魅力一樣工作。我敢打賭,我現在可以得到我想要的信息,即我已經得到了索引的後半部分。非常感激。謝謝。 – RasterGod 2013-02-19 07:30:08
如果它解決/回答你的問題,你可以接受它作爲答案。謝謝! :-) – rickerbh 2013-02-19 08:39:03
我是新來的stackoverflow。我當然會。 =) – RasterGod 2013-02-19 10:41:59