zoukankan      html  css  js  c++  java
  • 让TabelView视图中自定义的Toolbar固定(不随cell的移动而移动)

    //在viewDidLoad方法中创建Toolbar
    toolbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 66)]; toolbar.backgroundColor = [UIColor redColor]; //添加到tableView中
    [self.tableView addSubview:toolbar];


    //在当前继承
    UITableViewController的视图控制器中实现此方法(y值:self.tableView.contentOffset.y)

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

        toolbar.frame = CGRectMake(0, self.tableView.contentOffset.y , 320, 66);

    }

    
    
     5月24号有了新的想法:
    
    1.让当前控制器继承UIViewController,实现UITableViewDataSource和UITableViewDelegate。
    
    2.定义UITableView,创建好了tableView之后,把tableView添加到当前控制器的view中,设置好tableView的frame。
    
    3.自定义Toolbar,把toolbar也添加到当前控制器的view中。
    
    这样Toolbar就不会随着cell的移动而移动了。
    
    智商不行,到现在才想到...
  • 相关阅读:
    Vue入门
    吃透SprinngBoot
    SSM整合详解
    Linux查找端口并关闭
    接入腾讯云的OCR识别身份证信息
    IDEA 快捷键《宋红康版》
    Mysql详解
    docker常见命令
    SpringBoot集成Redis
    使用mybatis出现异常
  • 原文地址:https://www.cnblogs.com/hw140430/p/3746605.html
Copyright © 2011-2022 走看看