How to return a NSIndexPath for an object in an UITableView

Discussion in 'iOS Programming' started by ross.32, Jun 15, 2009.

  1. ross.32 macrumors 6502

    May 27, 2007
    I have a UITableView that contains a list of every NEXRAD weather radar (in the form of a custom object called a RadarSite)in the United States. The radars are sorted into different sections by their state. If I specify a RadarSite object, I need to have a method that will return the NSIndexPath for that particular RadarSite. Is their an easy way to achieve this? Thanks in advance!
  2. Saladinos macrumors 68000


    Feb 26, 2008
    So you get this array of RadarSites from somewhere, populate the table with them, and don't know which RadarSite is in which row?

    You need to structure the way you enter data in to the UITableView. So, if you section them by state, have an NSDictionary with the state as the key and a sorted Array of RadarSites as the values. Then you can select the correct value from the section and correct RadarSite either by row or by searching for matching data (maybe using tags on the cells).
  3. ross.32 thread starter macrumors 6502

    May 27, 2007
    Thanks for the help. I ended up getting it to work using an embedded for loop.

Share This Page