Appcelerator titanium

2,189 views
2,115 views

Published on

A

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,189
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Appcelerator titanium

  1. 1. Appcelerator Titanium Eller hur man skriver javascript och väntar på att det kompileras, typ.måndag den 7 mars 2011
  2. 2. Objekt? Titanium.UI.createTabGroup({ TabGroup() id:tabGroup1 }); 1 * Window() Titanium.UI.createWindow(); 1 * Titanium.UI.createView({ id:viewquestion, View() url:fil.js }); * * Widget() Titanium.UI.createButton();måndag den 7 mars 2011
  3. 3. Filstruktur? GLHF! FÖRSLAG? - Ruby on rails Titanium.include(”views/questions/new.js”); var new_question = Titanium.UI.createView({ id: newquestion, url: views/questions/new.js, height: 500, width: 100 });måndag den 7 mars 2011
  4. 4. EventListeners! var xhr = Titanium.Network.createHTTPClient(); var title = Titanium.UI.createTextField(); var question = Titanium.UI.createTextArea(); var author = Titanium.UI.createTextField(); var submit = Titanium.UI.createButton({ title: Skicka! }); submit.addEventListener(click,function(){ data = { "headerInput":title.value, "textInput":question.value, "nameInput":author.value }; Titanium.API.info(JSON.stringify(data)); xhr.open(POST, "http://localhost:8888/wtfisthis/api/?resource=questions"); xhr.send(data); });måndag den 7 mars 2011
  5. 5. Problem? app.js instansierar och håller koll på allt Globala variabler Finlir med javascript = svårt! Ingen hjälp med struktur!måndag den 7 mars 2011
  6. 6. Gitignore?måndag den 7 mars 2011
  7. 7. Är WebViews app.js lösningen? navGroup=.... Ti.App.addEventListener(callbackUpdateForm, callbackUpdateForm); signupWebView = Ti.UI.createWebView({url: "screens/signup.html"}); var signupWin = Ti.UI.createWindow({title: "SignUp",barColor: #111}); . signupWin.add(signupWebView); navGroup.open(signupWin,{animated:true}); . function callbackUpdateForm(passedData){ var s = "document.signup.q.value=Test; document.signup.submit();"; signupWebView.evalJS(s); } screens/signup.html signup.html: <form name=signup action="signup2.html" method="POSt" onsubmit="return process()"> </form> <script> function process(){ Ti.App.fireEvent(callbackUpdateForm, {}); </script>måndag den 7 mars 2011
  8. 8. måndag den 7 mars 2011

×