Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Marimuthu

macrumors member
Original poster
Oct 18, 2010
43
0
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

NSRect rectForDisplay = [ viewObj rectOfRow:rowSelected ];
[viewObj setNeedsDisplayInRect:rectForDisplay];

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.
 
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.
 
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.
 
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.

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.
 
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.
 
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.

Try the NSScrollView method -documentView, that should return the table view.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.