UISearchBar AutoLayout ios7 Error?

I am using AutoLayout and have UISearchBar, UITableView ad UIView. Initially, the layout is correct and placed in accordance with my AutoLayout rules.

enter image description here

When the UISearchBar has focus, it expands sharply in height, covering my top UIView.

enter image description here

No matter how I compose my autodetection constraints, this happens.

If I do not install

self.searchBar.translatesAutoresizingMaskIntoConstraints = NO; 

and set the frame instead, then it behaves as usual.

 self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 100.0f, 45.0f)]; 

But I rely on AutoLayout in this app for iOS7. Is this a real mistake? Or, most likely, I missed something!

+7
ios autolayout ios7
source share
1 answer

There was the same problem. Try this in viewDidLoad

 if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { self.edgesForExtendedLayout = UIRectEdgeNone; } 
+3
source share

All Articles