iphone - change UILabel frame dynamically in custom TableViewCell -
i have written subclass of uitableviewcell consists of various uilabels have defined style of uilabel in
- (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring*)reuseidentifier
and frame rect of labels in
- (void)layoutsubviews
now after defining static rect uilabels want modify rect of uilabels, , write function in modifying frame labels, calling function doesn't modify frame of uilabels.
if has idea how achieve dynamic frame of labels please share it.
the way typically achieve implementing custom tableviewcell , implement own drawrect method in subview specify size of label, this:
@implementation compositesubviewbasedrestaurantcellcontentview - (id)initwithframe:(cgrect)frame cell:(restaurantcell *)cell { if (self = [super initwithframe:frame]) { _cell = cell; self.opaque = yes; self.backgroundcolor = _cell.backgroundcolor; } return self; } - (void)drawrect:(cgrect)rect { _highlighted ? [[uicolor whitecolor] set] : [[uicolor blackcolor] set]; [_cell.name drawatpoint:cgpointmake(11.0, 22.0) withfont:[uifont boldsystemfontofsize:17.0]]; }
i think apple examples pretty good, instance table view suite:
Comments
Post a Comment