-1
正在逐漸從集合視圖選擇的小區位置的iOS從NSIndexpath得到NSInteger的
- (void)buttonPressed:(id)sender
{
NSLog(@"button clicked");
// CGPoint buttonPosition = [sender convertPoint:CGPointZero
// toView: GlossaryCollView];
NSIndexPath *centerCellIndexPath =
[self.GlossaryCollView indexPathForItemAtPoint:
[self.view convertPoint:[self.view center] toView:self.GlossaryCollView]];
NSLog(@"cell index path :%@",centerCellIndexPath);
}
它給出的值的NSLog = {長度= 2,路徑= 0 - 1}
由此我只需要路徑的第一個值..我怎麼能得到它?
我可以使用此代碼得到最後的價值..
NSUInteger lastIndex = [centerCellIndexPath indexAtPosition:[centerCellIndexPath length] - 1];
好工作兄弟,做得很好 –