NSClassFromString用法案例

34 篇文章 0 订阅
20 篇文章 0 订阅

转自:http://www.360doc.com/content/13/1105/10/8310724_326748553.shtml

    self.tabBar.items = @[//客户

                          @{@"normal"@"tabbar/kehu.png",

                            @"selected"@"tabbar/kehu_sel.png"},

                          //保单

                          @{@"normal"@"tabbar/baodan.png",

                            @"selected"@"tabbar/baodan_sel.png"},

                          //计划

                          @{@"normal"@"tabbar/jihua.png",

                            @"selected"@"tabbar/jihua_sel.png"},

                          //活动

                          @{@"normal"@"tabbar/huodong.png",

                            @"selected"@"tabbar/huodong_sel.png"},

                          //销售

                          @{@"normal"@"tabbar/xiaoshou.png",

                            @"selected"@"tabbar/xiaoshou_sel.png"}

                          //伙伴

                          @{@"normal"@"tabbar/huoban.png",

                            @"selected"@"tabbar/huoban_sel.png"},

                          //设置

                          @{@"normal"@"tabbar/shezhi.png",

                            @"selected"@"tabbar/shezhi_sel.png"},

                          //消息

                          @{@"normal"@"tabbar/message.png",

                            @"selected"@"tabbar/message_sel.png"}//工具

                          //工具

                          @{@"normal"@"tabbar/tool.png",

                            @"selected"@"tabbar/tool_sel.png"}

                          ];


self.viewControllers = @[//客户

                          [self itemVC:@"TPLCustomerListController"],

                          //保单

                          [self itemVC:@"TPLPolicyInfoHomeController_new"],

                          //计划

                          [self itemVC:@"TPLAgendaHomeController"],

                          //活动

                          [self itemVC:@"TPLCallonHomeController"],

                          //销售

                          [self itemVC:@"TPLInsuplanHomeController"],

                          //绩效

                          [self itemVC:@"TPLReportHomeController"],                          

                          //伙伴

                          [self itemVC:@"TPLPartnerHomeController"],

                          //设置

                          [self itemVC:@"TPLSettingHomeController"],

                          //消息

                          [self itemVC:@"TPLMessageHomeController"],

                          //工具

                          [self itemVC:@"TPLToolHomeViewController"]];




- (UIViewController*)itemVC:(NSString*)className {

    TPLViewController* vc = (TPLViewController*)[[NSClassFromString(className) alloc]init];

    if (nil == vc) {

        return nil;

    }

    if (![vc isKindOfClass:[TPLTabItemViewController class]]) {

        [NSException raise:NSInvalidArgumentException format:@"tabitem基类必须为TPLTabItemViewController"];

    }

    vc.naviBarHidden = YES;

    

    return [[TPLNavigationController allocinitWithRootViewController:vc];

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值