zoukankan      html  css  js  c++  java
  • loadView加载(变换成ScrollView)

    /**loadView加载,将系统的view变换成ScrollView*/

    - (void)loadView{

         [super loadView];

        UIScrollView *mainScroll =  [[UIScrollView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];

        mainScroll.scrollEnabled = YES;

        

        mainScroll.contentSize = CGSizeMake(0, VIEW_MAIN_SCREEN_HEIGHT + 40);

        mainScroll.userInteractionEnabled = YES;

        mainScroll.showsVerticalScrollIndicator = NO;

        mainScroll.multipleTouchEnabled = YES;

     mainScroll.delegate = self;

        self.view = mainScroll;

    }

    //然后在拖拽完成后,增加它的高度,以最后一个控件最大的Y值加上一定间隙,思路是判断view上最下面的view是否大于scrollView的高度,如果大于让滚动,并且scrollView的contentSize的height加上一定间隙

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView{

        CGFloat DeleteY = CGRectGetMaxY(self.OrderDeleteBtn.frame);

        if (DeleteY > scrollView.frame.size.height) {

            scrollView.scrollEnabled = YES;

        }else{

            scrollView.scrollEnabled = NO;

        }

    }

    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{

        CGFloat DeleteY = CGRectGetMaxY(self.OrderDeleteBtn.frame);

        if (DeleteY > scrollView.frame.size.height) {

             scrollView.contentSize = CGSizeMake(Screen_size.width, CGRectGetMaxY(self.OrderDeleteBtn.frame)+10);

        }else{

              scrollView.contentSize = CGSizeMake(Screen_size.width,200);

        }

    }

    将来的自己,会感谢现在不放弃的自己!
  • 相关阅读:
    C#枚举(一)使用总结以及扩展类分享
    .NET使用DinkToPdf将HTML转成PDF
    .NET使用MailKit进行邮件处理
    socket+django
    mysql 修改编码格式
    django中Model表的反向查询
    浅谈 session 会话的原理
    浅谈 django Models中的跨表
    django Models 常用的字段和参数
    encoding/xml
  • 原文地址:https://www.cnblogs.com/TheYouth/p/4994162.html
Copyright © 2011-2022 走看看