我想为UITableView
获取选中的索引。
我已经编写了以下代码:
NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
[tableView scrollToRowAtIndexPath:index
atScrollPosition:UITableViewScrollPositionTop
animated:YES];
这对于第一个项目总是有效的。我想在indexPathForRow
中有所选索引。
请帮忙。 谢谢。
*selectedIndexPath
,对于我来说访问long pathRow = [selectedIndexPath row()];
和long pathSection = [selectedIndexPath section()];
是非常有用的,当您需要特定的选择时(请注意,NSInteger
是typedef long
,这来自 C 背景,因为两者都需要%ld
,所以更有意义)。 - Jonathan Weinraub