UISearchBar动画问题 [英] UISearchBar animation issue
本文介绍了UISearchBar动画问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个UIViewController我希望用serchBar显示一个tableview。简单:
I have a UIViewController in wich I want to show a tableview with the serchBar. As Simple as That:
//viewDidLoad
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
0,
SCREEN_WIDTH(),
SCREEN_HEIGHT())
style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_tableView];
// adding uisearch bar
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
_tableView.tableHeaderView = searchBar;
//
searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
当我在uisearch栏内点击以便动画开始并且它看起来像是20px不需要的偏移
The issue happens when I click inside the uisearch bar so that the animation starts and it looks like it has a 20px unwanted offset
推荐答案
提醒任何有类似问题的人。我需要添加固定内容的这一行:
As a reminder for anyone with similar issues. I needed to add this line that fixed things:
self.edgesForExtendedLayout = UIRectEdgeNone;
这篇关于UISearchBar动画问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文