美文网首页
列表界面—上拉,发布按钮消失,下拉,按钮出现

列表界面—上拉,发布按钮消失,下拉,按钮出现

作者: 未来可期me | 来源:发表于2016-10-31 18:00 被阅读37次
zqk.gif
//MARK: 创建发布商品的btn
-(void)creatPublishGoodsBtn{
    _addButton =[UIButton buttonWithType:UIButtonTypeCustom];
    _addButton.frame =CGRectMake((MainScreenWidth -40)/2, MainScreenHeight -50, 40, 40);
    [_addButton setBackgroundImage:[UIImage imageNamed:@"postNew"] forState:UIControlStateNormal];
    [_addButton addTarget:self action:@selector(postNewTieziInPindao) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_addButton];
}
//MARK: <scrollView delegate>
- (void) scrollViewDidScroll:(UIScrollView *)scrollView{
    if (scrollView != _tableView) {
        return;
    }
    if (scrollView.contentOffset.y > 0 && (_contentY - scrollView.contentOffset.y < 0)) {
        if (_addButton.hidden == NO) {
            _addButton.hidden = YES;
        }
    }else{
        if (_addButton.hidden == YES) {
            _addButton.hidden = NO;
        }
    }
    _contentY = scrollView.contentOffset.y;
    
}

相关文章

网友评论

      本文标题:列表界面—上拉,发布按钮消失,下拉,按钮出现

      本文链接:https://www.haomeiwen.com/subject/hcuputtx.html