didSelectRowAtIndexPath with section
-
30-10-2019 - |
سؤال
I have a UITableView which I have assigned sections. When using didSelectRowAtIndex with indexPath.row I am not getting the correct value. Let's say I'm in section 2, then it starts the row index at 0 again and therefore I am getting the wrong index.
Can anyone tell me how to fix this? I realize that it is possible to get the section index by indexPath.section but I can't figure out how to use this.
bandDetailViewController.band = [self.programArray objectAtIndex:indexPath.row];
I hope you can help me. Thanks in advance :-)
EDIT:
Sample data. My cells for the table view is loaded from this 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>
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow