Update single row in NSScrollView

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

  1. Marimuthu macrumors member

    Oct 18, 2010
    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. Marimuthu thread starter macrumors member

    Oct 18, 2010
    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. blueillusion macrumors member

    Aug 18, 2008
    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. gnasher729 macrumors P6


    Nov 25, 2005
    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. Marimuthu thread starter macrumors member

    Oct 18, 2010
    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. Sydde macrumors 68020


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

Share This Page