0
点赞
收藏
分享

微信扫一扫

iOS 滚动视图,上滑隐藏,下滑显示,某个视图 笔记


Code


- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat offsetY = scrollView.contentOffset.y;
BOOL flag = NO;

if (_offsetY < offsetY) { // 需要隐藏
flag = YES;
}

if (_button.alpha == 1 // 没有隐藏
&& flag // 需要隐藏
&& offsetY > 0 // 处理顶部下拉回弹
) {
[UIView animateWithDuration:0.25 animations:^{
_button.alpha = 0;
}];
}
else if (_button.alpha == 0 // 已经隐藏
&& !flag // 需要显示
&& (scrollView.mj_footer.state == MJRefreshStateIdle // 正常状态(刷新状态不)显示
|| scrollView.mj_footer.state == MJRefreshStateNoMoreData // 没有更多数据
)) {
[UIView animateWithDuration:0.25 animations:^{
_button.alpha = 1;
}];
}

_offsetY = offsetY;
}

多种样式的验证码输入框

​​https://github.com/xjh093/JHVerificationCodeView​​


举报

相关推荐

0 条评论