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:

enter image description here

because of that, make sure set clipstobounds yes:

enter image description here

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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -