gpt4 book ai didi

uitableview - UISearchBar 动画问题

转载 作者:行者123 更新时间:2023-12-03 12:44:38 25 4
gpt4 key购买 nike

我有一个 UIViewController,我想在其中显示一个带有 serchBar 的表格 View 。

//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 不需要的偏移量时,就会出现问题。

最佳答案

在您的 Storyboard 中,选择有问题的 Controller ,查看 Attributes 选项卡并尝试编辑这些设置:

  • 在顶栏下
  • 在不透明条下

  • 我已经通过 解决了类似的问题坚定不移这些设置。

    关于uitableview - UISearchBar 动画问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19467945/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com