Home     RSSRSS

First iPad app

March 22, 2011 by Brian | Filed under play.

Wrote my first iPad application tonight. Took me longer to redo the signer cert and provisioning profiles than to write the code… but it was worth it.

I used Titanium Mobile which I’ve played with in the past.

The goal of this app is to teach my kids the positions on the baseball field.

Here it is in all it’s glory

var win1 = Titanium.UI.createWindow({
  top: 0,
  left: 0,
  backgroundColor:‘#fff’
});

var webview = Titanium.UI.createWebView({
  top: 20,
  left: 0,
  height: ’75%’,
  url:‘./baseball_diamond.jpg’
});

var label = Titanium.UI.createLabel({
    text:‘Where is Right Field?’,
    bottom: ’50px’,
    height:‘auto’,
    width:‘auto’,
    shadowColor:‘#aaa’,
    shadowOffset:{x:5,y:5},
    color:‘#900′,
    font:{fontSize:48},
    textAlign:‘center’
});

webview.addEventListener(‘singletap’, function(e) {
  point = e.globalPoint;
  if (point.x > 480 && point.x < 766 && point.y > 382 && point.y < 624) {
    label.text = "Right!";
  } else {
    label.text = "WRONG!";
  }
});

win1.add(webview);
win1.add(label);
win1.open();
 


Tags: , ,