Update single row in NSScrollView

Discussion in 'Mac Programming' started by Marimuthu, Mar 28, 2012.

  1. macrumors member

    Joined:
    Oct 18, 2010
    #1
    Dear All,

    I have a scroll view control which i used to display some data.
    Is it possible for me to just update a single row which I select in the scroll view?

    I know that I can call reloadData on the scroll view object but this will update all the elements in the row which I do not desire.

    I did try this code

    But I find that any changes to the data corresponding to the row (at the backend) is not reflected/updated in that row.

    Could somebody help me resolve this issue?

    Thanks & Regards.
     
  2. thread starter macrumors member

    Joined:
    Oct 18, 2010
    #2
    Is it not possible to update an individual cell in a scroll view?

    Don't I have any other option but to call reloadData method?

    Thanks & Regards.
     
  3. macrumors member

    Joined:
    Aug 18, 2008
    #3
    Do you mean update a single row in a tableview (embedded in a scroll view?)
    If so, it is definitely possible. I'm doing this in a few of my own apps as well.

    When I get home from work, I'll try to paste the relevant code.
    I ran into the same problem as you, but I can't exactly remember the correct solution at the moment.
     
  4. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #4
    You can't call reloadData on a scroll view. You can call it on a tableview inside the scroll view.

    Now read the documentation for reloadData and read a bit further on that page.
     
  5. thread starter macrumors member

    Joined:
    Oct 18, 2010
    #5
    Yes, I want to update a single row.

    I am relatively new to UI development hence please forgive me if my question is obvious to many.

    In my app, I call the reloadData using an object derived from NSScrollView to update all the rows. I am working on a project which this UI was implemented by somebody else who is not available now.

    I am not sure if I am embedding the tableview into scrollview.

    If there is an mechanism to get the pointer to tableview from Scrollview object and then using the tableview object to access and update individual cells in table view, then i think the requirement is achieved.
     
  6. macrumors 68000

    Sydde

    Joined:
    Aug 17, 2009
    #6
    Try the NSScrollView method -documentView, that should return the table view.
     

Share This Page