我有一个 UITableView 我已经分配了部分。将 didSelectRowAtIndex 与 indexPath.row 一起使用时,我没有得到正确的值。假设我在第 2 部分,然后它再次从 0 开始行索引,因此我得到了错误的索引。
谁能告诉我如何解决这个问题?我意识到可以通过 indexPath.section 获取节索引,但我不知道如何使用它。
bandDetailViewController.band = [self.programArray objectAtIndex:indexPath.row];
我希望你能帮助我。提前致谢 :-)
编辑:
样本数据。我的表格视图单元格是从此 plist 加载的。
<array>
<dict>
<key>name</key>
<string>Alphabeat</string>
<key>description</key>
<string>Long description.</string>
<key>scene</key>
<string>Store Scene</string>
<key>date</key>
<date>2011-02-04T20:09:40Z</date>
<key>hasDate</key>
<true/>
<key>weekDay</key>
<string>Onsdag</string>
<key>youtubeVideo</key>
<string>http://www.youtube.com/watch?v=dB01PTZNpBc</string>
</dict>
<dict>
<key>name</key>
<string>Anne Linnet</string>
<key>description</key>
<string>Long description.</string>
<key>scene</key>
<string>Store Scene</string>
<key>date</key>
<date>2011-02-04T20:09:40Z</date>
<key>hasDate</key>
<true/>
<key>weekDay</key>
<string>Onsdag</string>
<key>youtubeVideo</key>
<string>http://www.youtube.com/watch?v=jWMSqS7fL9k</string>
</dict>
</array>