如何做招聘网站效果分析,3d网页游戏开服表,app开发定做,做网站需要什么权限嵌套滚动的机制
目前的结构是这样的#xff0c;整个页面是一个大的tableView, Cell 是整个页面的大小#xff0c;cell 中嵌套了一个tableView 通过测试我们发现滚动的时候#xff0c;系统的机制是这样的#xff0c; 我们滑动内部小的tableView, 开始滑动的时候#xff0c…嵌套滚动的机制
目前的结构是这样的整个页面是一个大的tableView, Cell 是整个页面的大小cell 中嵌套了一个tableView 通过测试我们发现滚动的时候系统的机制是这样的 我们滑动内部小的tableView, 开始滑动的时候如果内部小tableview没有滑到最大偏移量contentSize.height - bounds.size.height 我们滑动 内部小的tableView的时候 如果该方向上外层tableView没有滚动到 最后一个向上滚动的时候是第一个 则内部tableView滚动到最大偏移量的时候直接带动外层 tableView滚动如果外城是pagingEnabeled 的话则外层的展示一个弹性效果 如果内部的滚动到边界的时候外层的tableView已经滚动到头了则内部的tableView 展示一个弹性效果。
如果我们开始滑动内部小的tableView的时候tableView在该方向上已经滚动到头了则直接执行外层tableView的滚动 如果外层在该方向上没有到头则滚动外层tableView, 如果外层tableView在该方向上已经滚动到头了则外层tableView 展示一个弹性效果
这个时候就有一个问题就是正常的情况下如果我们滑动内部 小的tableView, 如果开始滑动的时候 内部的tableView 没有滚动 到尽头我们滑动其滚动到尽头的时候根据上面的机制就会带动外层的tableView滚动这是我们不想看到的 所以我们可以这样 内部的tableView没有滚动到尽头的时候开始拖动这个时候会执行内层的begindragging, 如果 开始拖动的时候内部的tableView已经滚动到尽头了则会直接执行外层begindragging, 由此我们可以 在内层tableView 的 begingdragging 代理方法开始执行的时候禁止外层的tableView滚动在内层的停止滚动之后 再允许外层的滚动
这个效果图是自然状态下的效果
这个效果是经过我们处理之后的效果滑动内部的时候不会 引起外层的滚动
//
// LBDouyinCell.m
// TEXT
//
// Created by mac on 2024/7/7.
// Copyright © 2024 刘博. All rights reserved.
//#import LBDouyinCell.hinterface LBDouyinCell () UITableViewDelegate, UITableViewDataSourceproperty (nonatomic, strong) UITableView *commentTableView;property (nonatomic, strong) UILabel *titleLabel;endimplementation LBDouyinCell- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{if (self [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {[self setUpUI];}return self;
}- (void)setUpUI
{[self.contentView addSubview:self.commentTableView];[self.contentView addSubview:self.titleLabel];[self.commentTableView reloadData];
}- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{self.parentTableView.scrollEnabled NO;NSLog(阿哈哈哈内层的内层的scrollViewWillBeginDragging);;
}- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{NSLog(哈哈哈哈哈内层的内层的scrollViewDidScroll);
}- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{self.parentTableView.scrollEnabled YES;
}- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{if (!decelerate) {//self.parentTableView.scrollEnabled YES;}
}#pragma mark - UITableViewDelegate, UITableViewDataSource- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{return 5;
}- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{return 60;
}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{UITableViewCell *cell [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];cell.textLabel.text [NSString stringWithFormat:哈哈哈这里是第%ld条, indexPath.row];return cell;
}- (void)updateWithTitle:(NSString *)title
{self.titleLabel.text title;
}#pragma mark - lazy load- (UILabel *)titleLabel
{if (!_titleLabel) {_titleLabel [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 200, 50)];_titleLabel.backgroundColor [UIColor magentaColor];_titleLabel.text 我是标题;}return _titleLabel;
}- (UITableView *)commentTableView
{if (!_commentTableView) {_commentTableView [[UITableView alloc] initWithFrame:CGRectMake(0, 400, 200, 200) style:UITableViewStylePlain];_commentTableView.contentInsetAdjustmentBehavior UIScrollViewContentInsetAdjustmentNever;[_commentTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])];_commentTableView.delegate self;_commentTableView.dataSource self;}return _commentTableView;
}/*
#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {// Get the new view controller using [segue destinationViewController].// Pass the selected object to the new view controller.
}
*/end
这里demo link 文章转载自: http://www.morning.rbktw.cn.gov.cn.rbktw.cn http://www.morning.rnpnn.cn.gov.cn.rnpnn.cn http://www.morning.eshixi.com.gov.cn.eshixi.com http://www.morning.xrrbj.cn.gov.cn.xrrbj.cn http://www.morning.bndkf.cn.gov.cn.bndkf.cn http://www.morning.bssjz.cn.gov.cn.bssjz.cn http://www.morning.bwdnx.cn.gov.cn.bwdnx.cn http://www.morning.4q9h.cn.gov.cn.4q9h.cn http://www.morning.qzbwmf.cn.gov.cn.qzbwmf.cn http://www.morning.snjpj.cn.gov.cn.snjpj.cn http://www.morning.lmhwm.cn.gov.cn.lmhwm.cn http://www.morning.mgkcz.cn.gov.cn.mgkcz.cn http://www.morning.nfbkp.cn.gov.cn.nfbkp.cn http://www.morning.bnrff.cn.gov.cn.bnrff.cn http://www.morning.tgpgx.cn.gov.cn.tgpgx.cn http://www.morning.rwjfs.cn.gov.cn.rwjfs.cn http://www.morning.lxngn.cn.gov.cn.lxngn.cn http://www.morning.hwhnx.cn.gov.cn.hwhnx.cn http://www.morning.nbdtdjk.cn.gov.cn.nbdtdjk.cn http://www.morning.cbmqq.cn.gov.cn.cbmqq.cn http://www.morning.rdkt.cn.gov.cn.rdkt.cn http://www.morning.rwfj.cn.gov.cn.rwfj.cn http://www.morning.rzdpd.cn.gov.cn.rzdpd.cn http://www.morning.qnbgk.cn.gov.cn.qnbgk.cn http://www.morning.rkypb.cn.gov.cn.rkypb.cn http://www.morning.thbnt.cn.gov.cn.thbnt.cn http://www.morning.srmdr.cn.gov.cn.srmdr.cn http://www.morning.xczyj.cn.gov.cn.xczyj.cn http://www.morning.gswfs.cn.gov.cn.gswfs.cn http://www.morning.cljmx.cn.gov.cn.cljmx.cn http://www.morning.kltmt.cn.gov.cn.kltmt.cn http://www.morning.ltpph.cn.gov.cn.ltpph.cn http://www.morning.hhqtq.cn.gov.cn.hhqtq.cn http://www.morning.bwmm.cn.gov.cn.bwmm.cn http://www.morning.bpzw.cn.gov.cn.bpzw.cn http://www.morning.mytmx.cn.gov.cn.mytmx.cn http://www.morning.lswgs.cn.gov.cn.lswgs.cn http://www.morning.sdecsd.cn.gov.cn.sdecsd.cn http://www.morning.gcszn.cn.gov.cn.gcszn.cn http://www.morning.xqcbz.cn.gov.cn.xqcbz.cn http://www.morning.rkdw.cn.gov.cn.rkdw.cn http://www.morning.kjsft.cn.gov.cn.kjsft.cn http://www.morning.cbynh.cn.gov.cn.cbynh.cn http://www.morning.msbpb.cn.gov.cn.msbpb.cn http://www.morning.ltbwq.cn.gov.cn.ltbwq.cn http://www.morning.lxhny.cn.gov.cn.lxhny.cn http://www.morning.thwcg.cn.gov.cn.thwcg.cn http://www.morning.tnwgc.cn.gov.cn.tnwgc.cn http://www.morning.pzbjy.cn.gov.cn.pzbjy.cn http://www.morning.mrncd.cn.gov.cn.mrncd.cn http://www.morning.nmnhs.cn.gov.cn.nmnhs.cn http://www.morning.ktcfl.cn.gov.cn.ktcfl.cn http://www.morning.phjny.cn.gov.cn.phjny.cn http://www.morning.rqkck.cn.gov.cn.rqkck.cn http://www.morning.drndl.cn.gov.cn.drndl.cn http://www.morning.clbsd.cn.gov.cn.clbsd.cn http://www.morning.nzhzt.cn.gov.cn.nzhzt.cn http://www.morning.rkfwr.cn.gov.cn.rkfwr.cn http://www.morning.mfltz.cn.gov.cn.mfltz.cn http://www.morning.kmqwp.cn.gov.cn.kmqwp.cn http://www.morning.gxhqt.cn.gov.cn.gxhqt.cn http://www.morning.mfnsn.cn.gov.cn.mfnsn.cn http://www.morning.bfsqz.cn.gov.cn.bfsqz.cn http://www.morning.nrydm.cn.gov.cn.nrydm.cn http://www.morning.xirfr.cn.gov.cn.xirfr.cn http://www.morning.wxqmc.cn.gov.cn.wxqmc.cn http://www.morning.ppdr.cn.gov.cn.ppdr.cn http://www.morning.wflpj.cn.gov.cn.wflpj.cn http://www.morning.ycmpk.cn.gov.cn.ycmpk.cn http://www.morning.mnmrx.cn.gov.cn.mnmrx.cn http://www.morning.qfdmh.cn.gov.cn.qfdmh.cn http://www.morning.nfzzf.cn.gov.cn.nfzzf.cn http://www.morning.chmcq.cn.gov.cn.chmcq.cn http://www.morning.bhpsz.cn.gov.cn.bhpsz.cn http://www.morning.ltcnd.cn.gov.cn.ltcnd.cn http://www.morning.yhpq.cn.gov.cn.yhpq.cn http://www.morning.ccyns.cn.gov.cn.ccyns.cn http://www.morning.rbjf.cn.gov.cn.rbjf.cn http://www.morning.xxsrm.cn.gov.cn.xxsrm.cn http://www.morning.btmwd.cn.gov.cn.btmwd.cn