andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 633 forks source link

Using AMScrollingNavbar with UITableViewController, some times appears black header on top. #111

Closed KanybekMomukeyev closed 9 years ago

KanybekMomukeyev commented 9 years ago

Using AMScrollingNavbar with UITableViewController, some times appears black header on top. There also UISearchBar. Used this one, no changes, have the latest version: [self setUseSuperview:NO];

Top viewController is UINavigationController, root view controller is UITableViewController which uses scroll navbar, when user press some button, root view controller is moved to UIViewController. If user wants to return to UITableViewController, which will be as root view controller, this issue happens.

ios simulator screen shot jan 31 2015 9 30 53

andreamazz commented 9 years ago

Do you show the navbar when the controller disappars?

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self showNavBarAnimated:NO];
}
KanybekMomukeyev commented 9 years ago

@andreamazz, yes i did.

andreamazz commented 9 years ago

You are referring to the nav controller's rootViewController... are you using the push segue or are you manually changing the root?

KanybekMomukeyev commented 9 years ago

when using like this one: [self.navigationController setViewControllers:@[self.someViewController] animated:NO];

and like this one [self.navigationController popViewController]; here root controller is TableViewController(scrollabe), also appears this issue

andreamazz commented 9 years ago

I'm not sure if setViewControllers: fires the viewWillDisappear call in the child that's being removed. try calling the showNavbar: method before changing root:

[self.oldViewController showNavBarAnimated:NO];
[self.navigationController setViewControllers:@[self.someViewController] animated:NO];
KanybekMomukeyev commented 9 years ago
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
 {
    return  40;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    self.headerView.headerTitleLabel.text = [SIActualDataManager sharedInstance].tableHeaderTitle;
    return self.headerView;
}

I removed header view for tableView, and everything working best!

andreamazz commented 9 years ago

Glad to hear that! :+1: