zoukankan      html  css  js  c++  java
  • 用MJExtension简化MVC

    首先引入MJExtension框架

    模型

    #import <Foundation/Foundation.h>
    @interface FundsModel : NSObject
    /**
     *  时间
     */
    @property (nonatomic, copy) NSString *change_time;
    /**
     *  类型
     */
    @property (nonatomic, copy) NSString *change_type;
    /**
     *  单元格剩余金额
     */
    @property (nonatomic, copy) NSString *user_money;
    /**
     *  可用备注
     */
    @property (nonatomic, copy) NSString *change_desc;
    @end

    视图

    @class FundsModel;
    @interface FundsTableViewCell : UITableViewCell
    @property (nonatomic, strong) UILabel *lbl_time;
    @property (nonatomic, strong) UILabel *lbl_type;
    @property (nonatomic, strong) UILabel *lbl_price;
    @property (nonatomic, strong) UILabel *lbl_remark;
    @property (nonatomic , strong)FundsModel *fund;
    
    @end
    
    -(void)setFund:(FundsModel *)fund{
        _fund = fund;
        self.lbl_time.text = fund.change_time;
        self.lbl_type.text = fund.change_type;
        self.lbl_price.text = fund.user_money;
        self.lbl_remark.text = fund.change_desc;
    }
    
    
    ----------
    
    

    控制器

    dataDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
            if ([[dataDic objectForKey:@"is_has_db"] integerValue] == 1) {
    
                UILabel *label = (UILabel*)[self.view viewWithTag:999];
                [label setHidden:YES];
    
                if (tableViewTag == 0)
                {
                    dataArr = [dataDic objectForKey:@"log"];
                    modelArr = [FundsModel objectArrayWithKeyValuesArray:dataArr];
    
                }
    
  • 相关阅读:
    并发容器梳理
    CAS总结
    原子类总结and-Git提交出现error: src refspec master does not match any的问题
    简单工厂模式小结
    JVM学习与问题总结——java内存区域与内存溢出异常
    反射机制学习记录
    观察者模式
    IDEA的一些常用设置
    建造者模式
    【[AH2017/HNOI2017]礼物】
  • 原文地址:https://www.cnblogs.com/liguangsunls/p/7219559.html
Copyright © 2011-2022 走看看