ios - UITableViewCell subclass: in what delegate method is it appropriate to do changes to the cells layer? -
i have created subclass of uitableviewcell set look/layout of cell. want add rounded corners cell calling setcornerradius on cells layer. know can set tableview:cellforrowatindexpath: when creating cell, this:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { mycell *cell = [tableview dequeuereusablecellwithidentifier:@"mycell"]; ... [cell.layer setcornerradius:7.0f]; [cell.layer setmaskstobounds:yes]; }
however, want keep look/layout related code inside subclass itself, question is:
in delegate method in uitableviewcell subclass appropriate changes cells layer?
if cell loaded nib, add code initwithcoder:
method. if create using -initwithstyle:reuseidentifier:
add there. basically, add appropriate init
method of cell subclass.
Comments
Post a Comment