Welcome, Guest
Username Password: Remember me

TableViewModel and tags
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: TableViewModel and tags

TableViewModel and tags 1 year, 6 months ago #1

Hi,

My project uses multiple nested autogeneratedviews and as a result it's getting a bit tricky to keep track of all them. Within methods like the detailViewWillAppearForCell is there an easy way to identify which ClassDefinition a cell is for or which detailTableViewModel it is representing. Or even better do you recommended any good ways of tieing up the tag field to say a Class or PropertyDefinition ??

Any help would be great. Thanks.
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2

Re: TableViewModel and tags 1 year, 6 months ago #2

Thanks Phil for the interesting question.

There are many things you could do in these situations. First of all, STV automatically sets the tag property of auto generated cells to their corresponding class definition property index. Second, I always find it useful in these situations to set the tags of different detail models in the tableViewModel:detailViewWillAppearForRowAtIndexPath:withDetailTableViewModel: delegate method. You can set the tag according to the specific cell they correspond to, or according to their depth level (e.g. root model tag=0, 1st level tag=1, etc.) You can then always access the cell's model using its "ownerTableViewModel" property.

Please tell me if this is enough for your case.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72
  • Page:
  • 1
Time to create page: 0.75 seconds