Native UI MVC Framework Alloy MVC View xml

  • Slides: 11
Download presentation

Native UI

Native UI

MVC Framework

MVC Framework

Alloy MVC View(. xml) Controller(. js) <Window> <View> <Button id="btn"></Button> </View> <Window> $. btn.

Alloy MVC View(. xml) Controller(. js) <Window> <View> <Button id="btn"></Button> </View> <Window> $. btn. add. Event. Listener('click', function(){ alert('click!'); }); $. index. open(); Style(. tss) "Window": { title: 'My Window', background. Color : '#fff' } "View" : { border. Color : 'blue', border. Width : 1, width : 300, height: 100 }

WMDD 앱 (가칭) (Wearable Micro-Dust Detector)

WMDD 앱 (가칭) (Wearable Micro-Dust Detector)

index. xml / index. tss (View) <Alloy> <Window class="container"> <View id="map. View" module="ti. map"></View>

index. xml / index. tss (View) <Alloy> <Window class="container"> <View id="map. View" module="ti. map"></View> <Button id="hello. MOTButton" on. Click="show. Hello. MOT" bottom="0">HELLO</Button> <Button id="connect. To. GPSButton" on. Click="connect. To. GPS" bottom="0">GPS</Button> </Window> </Alloy> ". container": { background. Color: }, "white" "#map. View": { region: { latitude: longitude: latitude. Delta: longitude. Delta: } }, 33. 74511, -84. 38993, 0. 01, "Button": { top: width: height: } '10 dip', Titanium. UI. SIZE, "#hello. MOTButton": { left: '10 dip', } "#connect. To. GPSButton": { right: '10 dip', }

index. js function show. Hello. MOT(e) { alert("Hello MOT"); } function connect. To. GPS(e)

index. js function show. Hello. MOT(e) { alert("Hello MOT"); } function connect. To. GPS(e) { if(OS_ANDROID) { // 안드로이드 접근 권한을 얻는다. if(Ti. Geolocation. Services. Enabled) { // 설정에서 GPS가 켜진 상태이면 var android. Permission. Class = require('android. Permission'); var android. Permission = new android. Permission. Class(); if(android. Permission) { android. Permission. request. Location. Permissions(function() { // success callback Ti. Geolocation. get. Current. Position(Gps. Callback); }, function() { // failed callback alert('GPS 사용권한을 허가받지 못했습니다. '); } } else // 설정에서 GPS가 꺼진 상태이면 alert('설정 메뉴에서 GPS를 켠 후 다시 시도하십시오. '); } } function Gps. Callback(e) { // 다음 페이지에 별도로 추가. // GPS 값이 변경되면 “GPS” 버튼을 disable하고, 내 현재 위치로 이동한 후 주변에 회색 반투명 원과 빨간색 원을 그려줍니다. } $. index. open(); connect. To. GPS();

function Gps. Callback(e) { if(e. error) { $. connect. To. GPSButton. enabled = true;

function Gps. Callback(e) { if(e. error) { $. connect. To. GPSButton. enabled = true; alert('GPS error: ' +e. error); } else { $. connect. To. GPSButton. enabled = false; $. map. View. apply. Properties({ region: { latitude: e. coords. latitude, longitude: e. coords. longitude, latitude. Delta: 0. 01, longitude. Delta: 0. 01, }, }); var map. Module = require('ti. map'); var circle = map. Module. create. Circle({ center: { latitude: e. coords. latitude, longitude: e. coords. longitude, }, radius: 100, // 100 m stroke. Color: '#8080', // Hex triplet의 마지막 1바이트는 Opacity. fill. Color: '#8080', }); $. map. View. add. Circle(circle); var my. Position = map. Module. create. Circle({ center: { latitude: e. coords. latitude, longitude: e. coords. longitude, }, radius: 10, // 10 m stroke. Color: 'red', fill. Color: 'red', }); $. map. View. add. Circle(my. Position); } }

참고 URL http: //yomybaby. github. io/tilecture http: //www. slideshare. net/yomybaby/tidev-meetup-in-seoul-201308 http: //webskills. kr/archives/479 http:

참고 URL http: //yomybaby. github. io/tilecture http: //www. slideshare. net/yomybaby/tidev-meetup-in-seoul-201308 http: //webskills. kr/archives/479 http: //www. appcelerator. com