UITableView, get name of row?

Discussion in 'iOS Programming' started by Rappa819, Oct 1, 2009.

  1. Rappa819 macrumors newbie

    Joined:
    Feb 28, 2008
    #1
    So I went through this tutorial which was extremely helpful:

    http://www.youtube.com/watch?v=LBnPfAtswgw

    And after finishing them I was a little disappointed because the tutorial did not tell you how to load a different nib depending on which table item was selected.

    So I was wondering is there a way in the method didSelectRowAtIndexPath where I could just have an IF statement to do so, such as:

    Code:
    if(userSelects rowItem 1){
    load this nib
    }
    
    I think i've exhausted all my searching capabilities along with my books on iPhone programming.

    So if anyone knows how to do this or has a better way of doing so it would be greatly appreciated.
     
  2. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #2
    The clue's in the method name
     
  3. Rappa819 thread starter macrumors newbie

    Joined:
    Feb 28, 2008
    #3
    Then I must be doing it wrong because every variation I try does not work.

    if(indexPath == 1) ?
     
  4. Rappa819 thread starter macrumors newbie

    Joined:
    Feb 28, 2008
    #5
    so...

    if(((NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section)) == 1)?
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    That is not valid Objective-C. Or anything like it. Go back to the start: learn the basic syntax of the language then try and write code.
     
  6. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #7
    I think you need to step back a bit and do a bit of background reading as you don't seem to understand the basics. NSIndexPath (through the UIKit extensions) has two properties row and section. You would access those using

    indexPathVariableName.row and indexPathVariableName.section
     
  7. Rappa819 thread starter macrumors newbie

    Joined:
    Feb 28, 2008
    #8
    yeah, so i'm new. And i was looking for help. I got everything working fine up until this point. All i need to do is a simple if statement that I could do in any other language, but since I don't know objective c I was looking for some insight on how to do it.
     
  8. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #9
    The help is to learn the language and understand what you are doing. Copy/Pasting from examples teaches you nothing and is not programming.
     
  9. Rappa819 thread starter macrumors newbie

    Joined:
    Feb 28, 2008

Share This Page