ios - UITableViewCell imageView causes too much indention -
i have subclassed uitableviewcell setting imageview for. want keep @ 60x60, set frame , bounds in layoutsubviews method of subclass:
- (void)layoutsubviews { [super layoutsubviews]; self.imageview.bounds = cgrectmake(10,10,60,60); self.imageview.frame = cgrectmake(10,10,60,60); self.imageview.clipstobounds = yes; }//end this works great, until have image goes outside of bounds of imageview:

because of that, make sure set clipstobounds yes:

but can see still indenting textlabel , detailtextlabel though don't think should be.
how can fix issue?
you can set position of textlabel in -layoutsubviews implementation:
- (void)layoutsubviews { [super layoutsubviews]; self.imageview.bounds = cgrectmake(10,10,60,60); self.imageview.frame = cgrectmake(10,10,60,60); self.imageview.clipstobounds = yes; cgfloat x = 10.0 + 60.0 + 10.0; // padding, image width, , padding. cgrect frame = self.textlabel.frame; frame.origin.x = x; self.textlabel.frame = frame; frame = self.detailtextlabel.frame; frame.origin.x = x; self.detailtextlabel.frame = frame; } //end you want adjust value of x.
hope helps.
Comments
Post a Comment