-
Notifications
You must be signed in to change notification settings - Fork 0
/
HappyNewYear_tabbar.js
108 lines (53 loc) · 3.53 KB
/
HappyNewYear_tabbar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
require("UIColor, Home_tabbar_ViewController, Product_tabbar_ViewController, Guwen_tabbar_ViewController, Tips_tabbar_ViewController, User_tabbar_ViewController, NSMutableArray array, UITabBarItem, NSString, NSString, UIFont, UIFont, BaseNavViewController, UIImage, UIImage");
defineClass("Tabbar1_ViewController",{
viewDidLoad: function() {
self.ORIGviewDidLoad();
// self.setNavBarBgHappyNewYear();
// self.setTitleAsWhiteColor();
// self.initTipsLabel();
// self.modifyTabbarImg();
},
///修改按钮图片
init__tabVC: function() {
self.tabBar().setBackgroundColor(UIColor.whiteColor() );
var homeVC = Home_tabbar_ViewController.alloc().init() ;
var productVC = Product_tabbar_ViewController.alloc().init() ;
var guwenVC = Guwen_tabbar_ViewController.alloc().init() ;
var tipsVC = Tips_tabbar_ViewController.alloc().init() ;
var userVC = User_tabbar_ViewController.alloc().init() ;
var array =[homeVC,productVC,guwenVC,tipsVC,userVC];
var titles = ["首页","贷款产品","贷款顾问","贷款攻略","个人中心"];
var images = ["tab_home","tab_product","tab-adviser","tab_Raiders","tab_personal"];
// var views = NSMutableArray.array() ;
var views = new Array();
for (var i in images) {
var vc = array[i];
vc.setTitle(titles[i]);
var imageName = images[i];
imageName = "jsImage/"+imageName+".png";
var path = resourcePath(imageName);
var btnImg = require('UIImage').imageNamed(path);
if(btnImg == false){
path = 'https://m.taoqian123.com/images/theme-newyear/'+images[i]+'@2x.png';
imagedata = NSData.dataWithContentsOfURL(require('NSURL').URLWithString(path));
btnImg = UIImage.imageWithData_scale(imagedata, 2);
}
btnImg = btnImg.imageWithRenderingMode(1);
var title = titles[i];
var item =
UITabBarItem.alloc().initWithTitle_image_selectedImage(title,btnImg,btnImg) ;
///title 颜色
var titleDict1 = {"NSColor":UIColor.colorWithString("0x666666")};
var titleDict2 = {"NSColor":UIColor.colorWithString("0xff4318")};
item.setTitleTextAttributes_forState(titleDict1, 0) ;
item.setTitleTextAttributes_forState(titleDict2, 1<<2) ;
// item.setTitlePositionAdjustment(UIOffsetMake(0, -2));
var nav = BaseNavViewController.alloc().initWithRootViewController(vc) ;
nav.setTabBarItem(item);
// views.addObject(nav) ;
views[i] = nav ;
}
// console.log(views);
self.setViewControllers(views);
}
},{});