躺坑了,self.navigationController.navigationBar setTranslucent:YES

简介:

使用https://github.com/coolbeet/CBStoreHouseRefreshControl中的CBStoreHouseRefreshControl做了一个组件,

死活执行不了,后来发现,修改导航图片了

if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
        [self.navigationController.navigationBar setBackgroundImage:image
                                                      forBarMetrics:UIBarMetricsDefault];
    }

结果,发现下面这两个函数不在回调

#pragma mark - Notifying refresh control of scrolling
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    [self.storeHouseRefreshControl scrollViewDidScroll];
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    [self.storeHouseRefreshControl scrollViewDidEndDragging];
}

正常情况下,页面加载时,会回调这两个方法,重新计算里面相关位置。

只有设置导航图片后,如果不设置

self.navigationController.navigationBar setTranslucent:YES
或者设置

self.navigationController.navigationBar setTranslucent:NO

都不能触发这个消息,真吭爹啊


目录
相关文章
|
9月前
|
Swift iOS开发
iPad上的ActionSheet
最近公司的应用要做iPad的适配,所以这两天一直在调整项目的大小。
UINavigationBar-使用总结
UINavigationBar-使用总结
83 0
UINavigationController和UITabBarController合用。
UINavigationController和UITabBarController合用。
52 0
|
iOS开发
UISearchBar去除背景
UISearchBar去除背景
105 0
UISearchBar去除背景