1

I have a UISearchBarDisplayController, a text field, and a button in the header view of the tableView. I've tried putting...

self.searchBar.translatesAutoresizingMaskIntoConstraints = YES;

in the viewDidLoad. I've tried putting constraints, but it always crashes when I dismiss the displayController, either by hitting the cancel button or click on the background. I get the error...

2014-02-05 22:49:16.774 XXXX[3818:60b] *** Assertion failure in -[UITableView layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2903.23/UIView.m:8540
2014-02-05 22:49:16.777 XXXX[3818:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(0x2fd76e83 0x3a0d36c7 0x2fd76d55 0x3071f0af 0x324fb413 0x32181943 0x3217d167 0x32510231 0x32732d2f 0x327326b7 0x32532ab7 0x325329cf 0x32188413 0x3a5b80af 0x3a5ba9a9 0x2fd415b1 0x2fd3fe7d 0x2fcaa471 0x2fcaa253 0x349e42eb 0x3255f845 0x3b0bd 0x3a5ccab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
Bug
  • 2,576
  • 2
  • 21
  • 36
jgvb
  • 304
  • 5
  • 16
  • Where are you instantiating these views? In interface builder or in code? – bilobatum Feb 06 '14 at 08:44
  • I do it in interface builder. – jgvb Feb 06 '14 at 14:37
  • @bilobatum I also tried to put the search bar in another view inside of the header view. – jgvb Feb 06 '14 at 14:38
  • Don't set translatesAutoresizingMaskIntoConstraints to YES. You will need to post a screenshot of your layout and constraints in IB in order to get help. – bilobatum Feb 06 '14 at 21:16
  • When I add the constraints in IB, I do not set translatesAutoresizingMakingIntoConstraints to YES. See the first part of this question...http://stackoverflow.com/questions/21587134/uisearchbar-is-resizing-after-dismissal/21587346?noredirect=1#comment32613272_21587346. I set the width and height constraints as well as the top, left, and right, strut like constraints. – jgvb Feb 06 '14 at 21:33

0 Answers0