UISearchBar is resizing after dismissal

 ̄綄美尐妖づ 提交于 2019-12-13 05:13:06

问题


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?


回答1:


Just add height and width constraints to the search bar and pin it to top, left, and right.

You can do that here:

:

来源:https://stackoverflow.com/questions/21587134/uisearchbar-is-resizing-after-dismissal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!