1

I have a UITableViewCell subclass and after turning on Auto Layout I now get this error :

2013-01-29 15:46:15.555 iP2[6690:907] *** Assertion failure in -[MenuTableViewCell layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2372/UIView.m:5776
2013-01-29 15:46:30.357 iP2[6690:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. MenuTableViewCell's implementation of -layoutSubviews needs to call super.'

MenuTableViewCell being my sub class.

This is all to do with how IB has decided to auto-build the constraints for this cell I guess. Here's a screenshot of my IB setup for this cell : https://www.evernote.com/shard/s4/sh/0ec12042-7d37-4770-8d7a-c0c8c1e4e6f0/3192e32e8fde55dfe94c7269c428f73b

Lee Probert
  • 10,308
  • 8
  • 43
  • 70

2 Answers2

2

Turning off auto-layout fixed this for me, it seems like UITableViewCell doesn't support auto-layout, so you can subclass it and use auto layout in your design...

marmor
  • 27,641
  • 11
  • 107
  • 150
0

Could it be that you have to implement the layoutSubviews method? And it seems that you have send this message to super too. For example:

  • (void)layoutSubviews { [super layoutSubviews]; etc... }
Areal-17
  • 406
  • 3
  • 10
  • I included -(void)layoutSubviews { [super layoutSubviews]; } in case it was something crazy like that; but it still throws the error. I have a feeling that UITableViewCell may not be calling super in IT'S layoutSubViews method. – Lee Probert Jan 30 '13 at 09:56