码迷,mamicode.com
首页 > Web开发 > 详细

用MJExtension简化MVC

时间:2015-06-26 15:05:12      阅读:135      评论:0      收藏:0      [点我收藏+]

标签: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];

            }

用MJExtension简化MVC

标签:mvc

原文地址:http://blog.csdn.net/tubiebutu/article/details/46649213

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!