MCPcopy Create free account
hub / github.com/9miao/CrossApp / viewDidLoad

Method viewDidLoad

samples/Test/Classes/Control/ViewAnimationTest.cpp:38–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void ViewAnimationTest::viewDidLoad()
39{
40 winSize = this->getView()->getBounds().size;
41 winRect = this->getView()->getBounds();
42
43 if (AnimationNum == 0)
44 {
45 //Animation 1
46 heart_index = 0;
47 CAButton* btn1 = CAButton::create(CAButtonTypeRoundedRect);
48 btn1->setLayout(DLayout(DHorizontalLayout_W_C(240, 0.5), DVerticalLayout_H_C(56, 0.25)));
49 btn1->setTitleForState(CAControlStateNormal, "Play Animation");
50 btn1->setTitleColorForState(CAControlStateNormal, ccc4(51,204,255,255));
51 btn1->setTag(100);
52 btn1->addTarget(this, CAControl_selector(ViewAnimationTest::doAction), CAControlEventTouchUpInSide);
53 animation_1_view = CAImageView::createWithLayout(DLayout(DHorizontalLayout_W_C(28, 0.5), DVerticalLayout_H_C(24, 0.5)));
54 animation_1_view->setImage(CAImage::create("image/heart1.png"));
55
56 CAView* view1 = CAView::createWithLayout(DLayoutFill);
57 view1->addSubview(btn1);
58 view1->addSubview(animation_1_view);
59 view1->setColor(CAColor_gray);
60 this->getView()->addSubview(view1);
61 }
62 else if (AnimationNum == 1)
63 {
64 //Animation 2
65 CAImageView* bg = CAImageView::createWithLayout(DLayout(DHorizontalLayout_L_C(0, 0.5), DVerticalLayout_H_C(80, 0.5)));
66 bg->setImage(CAImage::create("image/navbg.jpg"));
67
68 animation_2_textfield = CATextField::createWithLayout(DLayout(DHorizontalLayout_L_C(90, 0.1), DVerticalLayout_H_C(50, 0.5)));
69 animation_2_textfield->setFontSize(40);
70 animation_2_textfield->setKeyboardType(CATextField::Default);
71 animation_2_textfield->setVisible(false);
72
73 animation_2_btn_search = CAButton::createWithLayout(DLayout(DHorizontalLayout_L_W(25, 56), DVerticalLayout_H_C(48, 0.5)), CAButtonTypeCustom);
74 animation_2_btn_search->setImageForState(CAControlStateNormal, CAImage::create("image/search_btn.png"));
75 animation_2_btn_search->addTarget(this, CAControl_selector(ViewAnimationTest::doAction), CAControlEventTouchUpInSide);
76 animation_2_btn_search->setTag(201);
77
78 animation_2_btn_cancel = CAButton::createWithLayout(DLayout(DHorizontalLayout_R_W(0, 100), DVerticalLayout_H_C(50, 0.5)), CAButtonTypeCustom);
79 animation_2_btn_cancel->setTitleForState(CAControlStateNormal, "Cancel");
80 animation_2_btn_cancel->setTag(202);
81 animation_2_btn_cancel->setTitleColorForState(CAControlStateNormal, CAColor_white);
82 animation_2_btn_cancel->addTarget(this, CAControl_selector(ViewAnimationTest::doAction), CAControlEventTouchUpInSide);
83 animation_2_btn_cancel->setVisible(false);
84
85 CAView* view2 = CAView::createWithLayout(DLayoutFill);
86 view2->addSubview(bg);
87 view2->addSubview(animation_2_textfield);
88 view2->addSubview(animation_2_btn_search);
89 view2->addSubview(animation_2_btn_cancel);
90 view2->setColor(CAColor_gray);
91 this->getView()->addSubview(view2);
92 }
93 else
94 {
95 //Animation 3

Callers

nothing calls this directly

Calls 15

DHorizontalLayout_W_CFunction · 0.85
DVerticalLayout_H_CFunction · 0.85
ccc4Function · 0.85
DHorizontalLayout_L_CFunction · 0.85
DHorizontalLayout_L_WFunction · 0.85
DHorizontalLayout_R_WFunction · 0.85
getViewMethod · 0.80
setLayoutMethod · 0.80
setTitleForStateMethod · 0.80
setTitleColorForStateMethod · 0.80
setImageForStateMethod · 0.80
addTargetMethod · 0.45

Tested by

no test coverage detected