【问题标题】:White line above UISearchDisplayControllerUISearchDisplayController 上方的白线
【发布时间】:2012-06-27 13:09:03
【问题描述】:

我遇到了 uisearchdisplaycontroller 的问题。 如果我将控制器的搜索栏添加到 tableviews headerview 它会在搜索栏上方显示一条细白线!如果我在没有搜索控制器的情况下添加搜索栏,它会正确显示。重要的是你要仔细查看标准的搜索显示控制器或对其进行一些自定义,否则你将无法看到这条线。

有人知道避开白线的方法吗?

BaseViewController 的 init 方法中的代码:UIViewController

   searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
   [searchBar sizeToFit];
   searchBar.showsCancelButton = NO;
   searchBar.barStyle = UIBarStyleDefault;
   searchBar.hidden = NO;

    searchBar.delegate = self;
    searchBar.placeholder = @"Suche";

    searchCtrl = [[UISearchDisplayController alloc]
                  initWithSearchBar:searchBar contentsController:self];
    searchCtrl.delegate = self;
    searchCtrl.searchResultsDataSource = self;
    searchCtrl.searchResultsDelegate = self;
    [searchCtrl searchResultsTableView].scrollsToTop = NO;

StartViewController 中的代码:viewWillAppear 中的 BaseViewController

tableController.tableView.tableHeaderView = searchCtrl.searchBar;
searchBar.hidden = NO;

if ( [tableController.tableView contentOffset].y == 0.0 )
{
    [tableController.tableView setContentOffset:CGPointMake(0.0, 44.0) animated:NO];        
}

没什么特别的,对我来说它与 UISearchDisplayController 无关,因为如果你只使用搜索栏一切都很好

【问题讨论】:

  • 也许你应该粘贴一些代码..

标签: iphone uikit uisearchdisplaycontroller


【解决方案1】:

设置searchBar.clipsToBounds = YES;

【讨论】:

    猜你喜欢
    • 2014-08-03
    • 1970-01-01
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多