if I set a search bar to the navigation titleView, like
navigationController?.navigationBar.topItem?.titleView = self.searchBar
, but I set it's frame by using autolayout like:
self.searchBar.snp_makeConstraints { make in
make.left.equalTo(leftSpace)
make.right.equalTo(-leftSpace)
make.top.equalTo(10)
make.height.equalTo(44)
}
, and then it will cause broken if I push to another view controller.
And if I set it's frame by using this way:
self.searchBar.frame = CGRectMake(leftSpace, 0, screenSize.width - 2 * leftSpace, 44)
it runs well...
Anyone can tell me why? Thx...