ios - Displaying complex data in a UITableViewCell -
i have custom uitableviewcell class use display quite complex set of data.
essentially cell displays match object. in doing displays information 2 teams, score, time elapsed , on.
thinking mvc , clean code.
should pass in match object , let cell everything? or better practise expose different elements of cell (team1namelabel, team1scorelabel, team2namelabel, etc...) , set them individually in uitableviewcontroller?
the first way makes uitableviewcontroller cleaner i'm relying on uitableviewcell "know" match class, team class etc...
the second way makes more work uitableviewcontroller makes uitableviewcell "dumb" display. lay out information within cell. doesn't know information displaying.
i follow these rules:
the cell should have outlets displaying various bits of data. view should not contain logic.
the controller should
matchdata, parse , make calculations if necessary, , populate cell. controller, primary function in mvc context.
Comments
Post a Comment