从原生 iOS 联系人应用程序获取钛的联系方式 [英] Get contact details to titanium from native iOS contact app

查看:38
本文介绍了从原生 iOS 联系人应用程序获取钛的联系方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是钛的新手.目前我正在做一个项目,用户需要使用 iOS 联系人应用程序中的联系方式.

我的 app.js 看起来像这样

Window = require('ui/handheld/ApplicationWindow');var win = Window();赢.打开();var button = Ti.UI.createButton({title : '显示联系人',宽度 : 100,身高:50,});赢.添加(按钮);button.addEventListener('点击',function(e){Titanium.Contacts.showContacts({});});

当我点击一个按钮时,会显示以下代码:

当我选择一个联系人时,详细信息会显示在另一个屏幕上:

但我不希望这样,当用户选择个人联系人时,详细信息应传递到我的 app.js 文件.并且无需转到详细信息页面.

有没有办法做到这一点?请帮我.提前致谢.

解决方案

我终于明白了.

我使用了以下代码:

button.addEventListener('click',function(e){Titanium.Contacts.showContacts(values);});var values = {cancel:function(){}};values.fields = ['firstName', 'lastName', 'phone'];values.selectedProperty = 函数(e){var cn = e.person.firstName;var sn = e.person.lastName;alert('姓名'+cn+''+sn);};

参考:Titanium 联系人

I'm new to Titanium. Currently I'm working on a project in this the user needs to use the contact details from iOS contacts App.

My app.js looks like this

Window = require('ui/handheld/ApplicationWindow');
var win = Window();
win.open();
var button = Ti.UI.createButton({
    title : 'Show Contacts',
    width : 100,
    height: 50,
});
win.add(button);
button.addEventListener('click',function(e){
    Titanium.Contacts.showContacts({ });
});

When I click on a button the following code is displayed:

And when I select an contact the detail is displayed on the other screen:

But I don't want this, When the user selects an individual contact the details should be passed to my app.js file. And no need to go to the details page.

Is there any way to do this ? Please help me. Thanks in advance.

解决方案

Finally I got it.

I used the following code:

button.addEventListener('click',function(e){
    Titanium.Contacts.showContacts(values);
});
var values = {cancel:function(){}};
values.fields = ['firstName', 'lastName', 'phone'];

values.selectedProperty = function(e) {
                var cn = e.person.firstName; 
                var sn = e.person.lastName;
                alert('Name'+cn+' '+sn);
};

Reference : Titanium Contacts

这篇关于从原生 iOS 联系人应用程序获取钛的联系方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆