1

How to Reduce the size of contentSize width of UITableViewCell.

-> I tried,in UITableView property but there had options for reduce the UITableViewCell contentSize of Height but not for Width.

-> I want to reduce the UITableViewCell contentSize width in UITableView.

Ashok Londhe
  • 1,491
  • 11
  • 29
Tamil_Arya
  • 29
  • 8
  • i can increase and decrease the height of content cell but i can't decrease the width... – Tamil_Arya May 12 '15 at 06:01
  • u have cell class , on that place reduce the width progrmatically – Anbu.Karthik May 12 '15 at 06:01
  • i tried but didn't work .height could be change but width doesn't? – Tamil_Arya May 12 '15 at 06:03
  • http://www2.zippyshare.com/v/wk5fEzMi/file.html see above pic.this is from tableview.i wanna reduce cell width... – Tamil_Arya May 12 '15 at 06:06
  • @Tamil_Arya there is no property of cell like contentCell.. you want to change the cell content size right. – Ashok Londhe May 12 '15 at 06:09
  • ya.i wanna change size the cell content but not height i wanna width. – Tamil_Arya May 12 '15 at 06:21
  • Thanks for reply,...Ashok Londhe .i got answer,.. - (void)layoutSubviews { self.bounds = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width - 50, self.bounds.size.height); [super layoutSubviews]; } http://natashatherobot.com/ios-frame-vs-bounds-resize-basic-uitableview-cell/ – Tamil_Arya May 12 '15 at 06:28

2 Answers2

1

You can not reduce cell width using cell property. You need to change UITableView frame size. Set width whatever you want to set.

Anoop
  • 409
  • 3
  • 13
  • It's not working if we want to update UITableViewCell frame based on the UITableView contentSize frame and not on UITableView frame? – Ben Aug 04 '15 at 13:40
0

// MyCustomUITableViewCell.m - (void)layoutSubviews {

self.bounds = CGRectMake(self.bounds.origin.x,self.bounds.origin.y,self.bounds.size.width - 50,self.bounds.size.height);

[super layoutSubviews];

} http://natashatherobot.com/ios-frame-vs-bounds-resize-basic-uitableview-cell/'

Tamil_Arya
  • 29
  • 8