Created
April 30, 2016 12:38
-
-
Save hansemannn/3ea14512f894bc507a5cea57336b7f77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UIView = require("UIKit/UIView"), | |
UIColor = require("UIKit/UIColor"), | |
CGRectMake = require("CoreGraphics").CGRectMake, | |
window = Ti.UI.createWindow({layout: "vertical"}); | |
// HL View | |
var view1 = UIView.alloc().initWithFrame(CGRectMake(20,20,100,100)); | |
view1.setBackgroundColor(UIColor.redColor()); | |
// TI View | |
var view2 = Ti.UI.createView({ | |
top: 20, | |
left: 20, | |
width: 100, | |
height: 100, | |
backgroundColor: "green" | |
}); | |
var btn1 = createButton("Remove HL View", function() { | |
window.remove(view1); | |
}); | |
var btn2 = createButton("Remove TI View", function() { | |
window.remove(view2); | |
}); | |
window.add(view1); | |
window.add(view2); | |
window.add(btn1); | |
window.add(btn2); | |
window.open(); | |
// Button Helper | |
function createButton(title, cb) { | |
var btn = Ti.UI.createButton({ | |
title : title, | |
height: 40, | |
width: 200, | |
top: 20, | |
backgroundColor: "#fff" | |
}); | |
btn.addEventListener("click", cb); | |
return btn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment