`
rensanning
  • 浏览: 3518325 次
  • 性别: Icon_minigender_1
  • 来自: 大连
博客专栏
Efef1dba-f7dd-3931-8a61-8e1c76c3e39f
使用Titanium Mo...
浏览量:37579
Bbab2146-6e1d-3c50-acd6-c8bae29e307d
Cordova 3.x入门...
浏览量:604650
C08766e7-8a33-3f9b-9155-654af05c3484
常用Java开源Libra...
浏览量:678516
77063fb3-0ee7-3bfa-9c72-2a0234ebf83e
搭建 CentOS 6 服...
浏览量:87540
E40e5e76-1f3b-398e-b6a6-dc9cfbb38156
Spring Boot 入...
浏览量:400045
Abe39461-b089-344f-99fa-cdfbddea0e18
基于Spring Secu...
浏览量:69129
66a41a70-fdf0-3dc9-aa31-19b7e8b24672
MQTT入门
浏览量:90644
社区版块
存档分类
最新评论

Titanium中支持IOS设备的拖拽

阅读更多
官方QA论坛中有人问及拖拽功能:

QA:http://developer.appcelerator.com/question/128143/several-items-drag-and-drop-functionality-support-for-ios

解决方案:Solution posted here(需要FQ)

通过一个第三方库函数来支持在ios设备的拖放操作,进一步加强titanium的功能。

TiDrop是一个opensource的库函数,可以从这里下载。

Example
Ti.include("TiDrop.js");

var tabGroup = Ti.UI.createTabGroup();

var window = Ti.UI.createWindow({  
    title: "Drag + Drop",
    backgroundColor: "#FFF"
});

var tab = Ti.UI.createTab({  
    title: "Drag + Drop",
    window: window
});

var box1 = Ti.UI.createView({
    width: 100,
    height: 100,
    top: 10,
    left: 10,
    backgroundColor: "#7A0000"
});

var box2 = Ti.UI.createView({
    width: 100,
    height: 100,
    top: 10,
    left: 120,
    backgroundColor: "#007A00"
});

var container1 = Ti.UI.createView({
    width: 300,
    height: 120,
    top: 237,
    left: 10,
    backgroundColor: "#CCC",
    items: 0
});

function yay(e) {
    if(e.contained) {
        e.source.top = 247;
        e.source.left = 20;
    }
}

TiDrop.init(box1, container1, yay);
TiDrop.init(box2, container1, yay);

window.add(container1);
window.add(box1);
window.add(box2);

tabGroup.addTab(tab);  
tabGroup.open();


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics