tableView 的常規效果:傳統和內邊距的設定
阿新 • • 發佈:2019-02-07
cell底部也會被TabBar擋住
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
設定穿透效果
//1.設定當有導航欄自動新增64的高度的屬性為NO
self.automaticallyAdjustsScrollViewInsets = NO;
[self hy_viewWillAppear:YES];
- (void)hy_viewWillAppear:(BOOL)animated {
//清除邊框,設定一張空的圖片
[self.navigationController .navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:nil];
//
[self setNavSubViewsAlpha];
}
- (void)setNavSubViewsAlpha {
self.navigationItem.leftBarButtonItem.customView.alpha = 0;
self.navigationItem.titleView .alpha = 1;
self.navigationItem.rightBarButtonItem.customView.alpha = 0;
[[[self.navigationController.navigationBar subviews]objectAtIndex:0] setAlpha:0];
}
恢復原來導航欄的主題
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat offsetY = KBannerScreenHeight;
CGPoint point = scrollView.contentOffset ;
self.baralpha = point.y/offsetY;
self.baralpha = (self.baralpha <= 0)?0:self.baralpha;
self.baralpha = (self.baralpha >= 1)?1:self.baralpha;
// [self setNavSubViewsAlpha];
NSLog(@"%f",self.baralpha);
if (self.baralpha >=1) {
[self hy_viewWillDisappear:YES];
}else{
[self hy_viewWillAppear:YES];
}
}