objective c - design & logic - Most efficient way to save reordered UITable rows -

the blue table called routine , other 1 called exercise.
routine.exercise has many-to-many relationship exercise.routine.
i have uitableview user can re-arrange order of items , having problems thinking way design entities can reorder them & save reorder position.
what want order position in uitable of exercises in x routine.
e.g: routine has been selected , has following items in following order.
e1 e3 e2 my problem comes when can not put order column in exercise entity because many-to-many relationship. thus, exercise have different position in different routines.
i though on creating different entity hold position data mean i'd have create x amount of column having in mind amount of columns have greater typical number of exercises routine have. far viable option wondering if there better solution there lots of rows unused , while storing mean looping through empty ones , nullify them in case.
can think better way or there better way in xcode store position of item in uitable? can store array in field?
i using coredata.
edit in response answer: 
a many-to-many relationship can re-written 2 one-to-many relationships join table in middle. is, create exerciseroutine table (or better name) represents matching of exercise , routine , put data specific relationship in there.
the less flexible way -- since want know order of exercises in routine -- store order array, connected routine.
(but recommend option #1 better general purpose technique.)
Comments
Post a Comment