更新时间:2023-10-28 23:16:58
只需向搜索栏添加高度和宽度约束并将其固定到顶部、左侧和右侧即可.
你可以在这里这样做:
:
I have a tableviewcontroller with a button, textfield, and a search bar display controller in the header view of the tableview.
When I click on the searchbar, then on either cancel or the background tableview(to dismiss it), the search bar will re size to cover the entire view it was in(over the button and text field).
In viewDidLoad I have
self.searchBar.translatesAutoresizingMaskIntoConstraints = YES;
Any ideas please?
Just add height and width constraints to the search bar and pin it to top, left, and right.
You can do that here:
: