BusinessViewController.m 4.47 KB
Newer Older
mei's avatar
mei committed
1 2 3 4 5 6 7 8 9 10
//
//  BusinessViewController.m
//  XFFruit
//
//  Created by mac on 15/8/13.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "BusinessViewController.h"

mei's avatar
mei committed
11 12 13 14 15
#import "ICRFunctionBaseView.h"
#import "ICRFunctionEntity.h"
#import "ICRFunctionBaseView.h"

@interface BusinessViewController ()<ICRFunctionBaseViewDelegate>
mei's avatar
mei committed
16 17 18 19 20 21 22

@end

@implementation BusinessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
mei's avatar
mei committed
23 24
//    [self initView];
    [self setupSubviews];
mei's avatar
mei committed
25 26 27 28 29 30
    // Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
mei's avatar
mei committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
-(void)setupSubviews
{
    NSMutableArray *arrFunctionEntities = [NSMutableArray array];
    
    NSArray *functionImageNames = @[ @"AnnouncementIcon",@"create_surver",@"watch_surver",@"create_surver_result",@"create_needs",@"watch_needs",@"create_purchase",@"watch_purchase",@"review_purchase",@"create_transport",@"watch_transort",@"create_process"];
    NSArray *fuctionNames = @[ [IBTCommon localizableString:@"Announcement"],
                               [IBTCommon localizableString:@"AddSurvey"],
                               [IBTCommon localizableString:@"Survey"],
                               [IBTCommon localizableString:@"Survey1"],
                               [IBTCommon localizableString:@"Survey2"],
                               [IBTCommon localizableString:@"Survey3"],
                               [IBTCommon localizableString:@"Survey4"],
                               [IBTCommon localizableString:@"Survey5"],
                               [IBTCommon localizableString:@"Survey6"],
                               [IBTCommon localizableString:@"Survey7"],
                               [IBTCommon localizableString:@"Survey8"],[IBTCommon localizableString:@"Survey9"],
                               ];
    NSArray *functionTags = @[ @(kFunctionAnnouncement),
                               @(kFunctionTaskManagement),
                               @(kFunctionPatrolPlan),
                               @(kFunctionMyShop),
                               @(kFunctionNavigation),
                               @(kFunctionComeShopReg),
                               @(kFunctionAnnouncement),
                               @(kFunctionTaskManagement),
                               @(kFunctionPatrolPlan),
                               @(kFunctionMyShop),
                               @(kFunctionNavigation),
                               @(kFunctionComeShopReg)];
    
    int i = 0;
    for (NSString *functionName in fuctionNames) {
        ICRFunctionEntity *funtionEntity = [[ICRFunctionEntity alloc] init];
        funtionEntity.functionName = functionName;
        funtionEntity.iconName = [functionImageNames objectAtIndex:i];
        funtionEntity.functionItemTag = [[functionTags objectAtIndex:i] integerValue];
        [arrFunctionEntities addObject:funtionEntity];
        i ++;
    }
    
    ICRFunctionBaseView *baseView = [ICRFunctionBaseView initWithFunctionData:arrFunctionEntities];
    
    baseView.frame = (CGRect){
        .origin.x = 0,
        .origin.y =0,
        .size.width = CGRectGetWidth(self.view.frame),
        .size.height = CGRectGetHeight(self.view.frame),};
    baseView.backgroundColor = [UIColor clearColor];
    baseView.m_delegate = self;
    [self.view addSubview:baseView];
mei's avatar
mei committed
81

mei's avatar
mei committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
}
-(void)initView
{
    NSArray *butArray=[[NSArray alloc]initWithObjects:@"公告", @"新建行情调研",@"查看行情调研",@"填写行情反馈",@"新建采购通知",@"查看采购通知",@"新建采购单",@"查看采购单",@"审核采购单",@"新建发运单",@"查看发运单",@"新建加工单",nil];
    for (int i=0; i<butArray.count; i++) {
        UIButton *but=[UIButton buttonWithType:UIButtonTypeCustom];
        but.frame=CGRectMake(15+i%3*(90+10),10+(i/3)*(100+10) , 90, 90) ;
//        but.titleLabel.text=[NSString stringWithFormat:@"%@",[butArray objectAtIndex:i]];
        NSString *str=[butArray objectAtIndex:i];
        [but setTitle:str forState:UIControlStateNormal];
        but.backgroundColor=[UIColor redColor];
        [self .view addSubview:but];
        
    }
    
}
mei's avatar
mei committed
98 99 100 101 102 103 104 105 106 107 108
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end