objective c - Custom UITableViewCells in iOS 8 and layoutMargin -


i have several custom uitableviewcells in app, defined nibs. when moving ios 8 , xcode 6 margins on left , right incorrect. these cells interspersed in table view default cells.

i made sample project, here margin issue i'm talking about: margin issue

the thing i've been able find relates new property layoutmargins. uitableviewcells value seems change depending on device app running on:

iphone 6 , below - layoutmargin: {8, 16, 8, 16} iphone 6 plus - layoutmargin: {8, 20, 8, 20} 

this seems line margins i'm seeing on standard cells. however, content custom cells inside cells contentview, has standard uiview layoutmargin of {8, 8, 8, 8}. means auto layout constraints bound container margin adding incorrect spacing.

the way i've found fix adding following in cellforrowatindexpath:

cell.contentview.layoutmargins = cell.layoutmargins; 

this doesn't seem solution going forward (especially since i'd need wrap in checks ios8 maintain compatibility).

does have ideas? feel must missing something.

you might want check out preservessuperviewlayoutmargins property. sound looking for.

add following cells need consistently spaced standard cells:

- (void)layoutsubviews {     [super layoutsubviews];      if ([self.contentview respondstoselector:@selector(setpreservessuperviewlayoutmargins:)]) {         self.contentview.preservessuperviewlayoutmargins = yes;     } } 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -