-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];
好工作兄弟,做得很好 –