[轉]雜記

來源:互聯網
上載者:User

標籤:

NSClassFromString用法案例

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 alloc] initWithRootViewController:vc];

}

[轉]雜記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.