zoukankan      html  css  js  c++  java
  • iOS tableView 选中某个cell时 标准的处理方法

    以前选中cell时,常常判断选中的行数,但是当cell的顺序发生变化时,就要改动处理函数,特别是行数比较多的时候,很麻烦。

    之后运用cell的title的内容判断,但是这种判断与现实的内容密切相关,如果改了title内容,也需要改动处理代码,也不正规。

    最标准的方法是,声明一个枚举类型,enum,这样如果改动了cell的顺序,只需要改动enum的定义就可以。

    代码如下:

    typedef NS_ENUM(NSInteger, MMProgressHUDDemoFeatureType) {
    
        MMProgressHUDDemoTypeStylePlain = 0,
    
        MMProgressHUDDemoTypeStyleBordered,
    
        MMProgressHUDDemoTypeStaticImage,
    
        MMProgressHUDDemoTypeAnimatedImage,
    
        MMProgressHUDDemoTypeAutosizing,
    
        MMProgressHUDDemoTypeConfirmation,
    
        MMProgressHUDDemoTypeRadialProgress,
    
         MMProgressHUDDemoTypeLinearProgress,
    
        MMProgressHUDDemoTypeOverlayColor,
    
        MMProgressHUDDemoTypeImageRemove,
    
    };
    
     switch (indexPath.section) {
    
            caseMMProgressHUDDemoSectionFeatures:
    
                switch (indexPath.row) {
    
                    caseMMProgressHUDDemoTypeAnimatedImage:                    
    
                        break;
    
                    caseMMProgressHUDDemoTypeAutosizing:                  
    
                        break;
    
                    caseMMProgressHUDDemoTypeConfirmation:
    
        }
       break;
    
    }                   

                       

  • 相关阅读:
    MySQL联结查询
    MySQL的一些优化方法
    MySQL 基本操作
    一个关于python定制类的例子
    用python类方法处理参数
    python global的用法
    sqli-libs(29(jspstudy)-31关)
    sqli-libs(23-28a关)
    sqli-libs(11-22关)
    sqli-libs(5-10关)
  • 原文地址:https://www.cnblogs.com/breezemist/p/3487887.html
Copyright © 2011-2022 走看看