Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hansemannn
Created April 30, 2016 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hansemannn/3ea14512f894bc507a5cea57336b7f77 to your computer and use it in GitHub Desktop.
Save hansemannn/3ea14512f894bc507a5cea57336b7f77 to your computer and use it in GitHub Desktop.
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