Skip to content

Bug: UITableView Hidden Search Bar Causes NavBar Scrolling Flicker #3

@thorst

Description

@thorst

Last comment, I promise, everything else is perfect.

I have a UITableView with a UISearchBar, and a UIRefreshControl. My goal is to add this GTScrollNavigationBar (with the addition of a sub menu Issue #1 ). When the search bar is visible by default, there are no issues. But when the search bar is set to be hidden by default it screws things up.

Start by modifying the example by:

  1. Modify DemoTableViewController.h
@interface DemoTableViewController : UITableViewController <UISearchBarDelegate, UISearchDisplayDelegate> {
    UISearchBar *searchBar;
    UISearchDisplayController *searchDisplayController;
}

2.Modify DemoTableViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refreshControl;

    //Uncomment this line, to reproduce the issue
    //[self.tableView setContentOffset:CGPointMake(0,44) animated:YES];

    searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    searchBar.placeholder = @"Filter Types";
    searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
    searchDisplayController.delegate = self;
    searchDisplayController.searchResultsDataSource = self;
    searchDisplayController.searchResultsDelegate = self;
    self.tableView.tableHeaderView = searchBar;
}
- (void)refresh:(UIRefreshControl *)refreshControl {
     [refreshControl endRefreshing];
}

Run this, and everything performs as expected. Then uncomment [self.tableView setContentOffset:CGPointMake(0,44) animated:YES];. Now, tap and hold near the bottom of the screen and drag up. Instead of the the menu scrolling out of view, it will almost disappear, and then snap back to normal height. It will continue this snapping until you remove your finger from the screen.

Any help on implementing this would be great. I this its got to be in handlePan or setFrame. Ill keep playing around with it, to see if i can get it on my own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions