I have a tableview which renders perfectly in iOS 6 & has done so for years. In iO7 in the same tableview either side of the cell.imageview its adding some extra padding approx 5mm either side of each image shown below thus moving my cell.textLabel.text further to the right. How would I remove this I cant seem to find the answer anywhere to this question?
IOS7 tableview cell.imageview extra padding
ios7uitableview
Related Topic
- Objective-c – Cannot hide status bar in iOS7
- Ios – Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7
- Ios – Why is there extra padding at the top of the UITableView with style UITableViewStyleGrouped in iOS7
- Objective-c – iOS7 excessive navigationbar button padding
- TableView backgroundView is not working in iOS7
- Objective-c – Tab Bar covers TableView cells in iOS7
Best Answer
In iOS7, the
UITableViewCell
's predefined propertyimageView
is indented towards right by 15pt by default.And this has nothing to do with the following
UITableViewCell
propertiesTherefore creating your own custom
UITableViewCell
is the best way to overcome it.According to Apple, there are 2 good ways to do it:
Solution:
As you don't prefer subclassing
UITableViewCell
, so adding custom subviews is your choice.Simply creates your own image view and text labels, and add them through code or through storyboard. e.g.
Note that as the predefined
UITableViewCell
content properties:cell.textLabel
,cell.detailTextLabel
andcell.imageView
are untouched so they will remindnil
and will not be shown.Reference:
A Closer Look at Table View Cells https://developer.apple.com/Library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW1
Hope this help!