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.
 

Marimuthu

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

blueillusion

macrumors member
Aug 18, 2008
56
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.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
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.
 

Marimuthu

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

Sydde

macrumors 68030
Aug 17, 2009
2,552
7,050
IOKWARDI
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.