UISearchBar 在解雇后调整大小 [英] UISearchBar is resizing after dismissal

查看:29
本文介绍了UISearchBar 在解雇后调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 tableview 的标题视图中有一个带有按钮、文本字段和搜索栏显示控制器的 tableviewcontroller.

当我点击搜索栏,然后点击取消或背景 tableview(关闭它)时,搜索栏将重新调整大小以覆盖它所在的整个视图(在按钮和文本字段上).

在 viewDidLoad 我有

self.searchBar.translatesAutoresizingMaskIntoConstraints = YES;

有什么想法吗?

解决方案

只需向搜索栏添加高度和宽度约束并将其固定到顶部、左侧和右侧即可.

你可以在这里这样做:

:

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:

:

这篇关于UISearchBar 在解雇后调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆