簡體   English   中英

如何在UITableView上隱藏部分的headView?

[英]how to hide a headView of section on UITableView?

我想在觸摸時隱藏導航欄和標簽欄,並在uitableview上移動,打擊代碼:_headView from viewForHeaderInSection這沒問題。 但是有時在執行塊之后,_headView是可見的

if(_headView)
    _headView.hidden = YES; //
[UIView animateWithDuration:0.5 animations:^{
    scrollView.frame = rect;
    _vc.navigationController.navigationBar.top -= navigationBarHeight;
    tabView.top =  SCREEN_HEIGHT;

} completion:^(BOOL finished) {
}];

如果我將隱藏代碼移至完成代碼塊,則運行正常,但在0.5秒后隱藏,則速度很慢。

[UIView animateWithDuration:0.5 animations:^{
    scrollView.frame = rect;
    _vc.navigationController.navigationBar.top -= navigationBarHeight;
    tabView.top =  SCREEN_HEIGHT;

} completion:^(BOOL finished) {
    if(_headView)
        _headView.hidden = YES;  //Delay after 0.5s.
}];

請幫助我,謝謝。

我們為UITableView的section設置高度提供了一個委托方法

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

只需為此返回0,即可隱藏標題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM