이미지를 가져 오는 데 필요한 코드가 있습니다. API 호출에서 가져온 이미지가 필요한 행이 있습니다. 나는 그것을 얻는 방법에 분실된다. 난 내 행appcelerator titanium 함수로 변수 전달하기
Ti.Facebook.requestWithGraphPath(Titanium.App.Properties.getString("pageID") +'/feed', {access_token: Token}, 'GET', function(e){
if (e.success) {
json = JSON.parse(e.result);
for (i = 0; i < json.data.length; i++) {
data = json.data[i];
row = Ti.UI.createTableViewRow({
height:'80dp',
// backgroundImage : 'images/tablebgl.png',
backgroundColor: 'transparent',
separatorColor:'transparent',
});
row.coverid = data.from.id;
var coverid = row.coverid;
Titanium.App.Properties.setString("cv", coverid);
var imag = Ti.UI.createImageView();
row.add(imag);
require('image').get.signUpConn(data, function(scrollView){
imag.setImage(scrollView);
});
어디서
이입니다 그리고 이것은 내 'image.js'
exports.signUpConn = function(data, callback) {
var scrollView = Ti.UI.createView({
top : 0,
right : -1,
left : -1,
backgroundColor : 'transparent',
width : '95%',
contentWidth : 'auto',
contentHeight : 'auto',
layout : 'horizontal'
});
var url = "https://graph.facebook.com/" + Titanium.App.Properties.getString("cv") + "?fields=cover";
var loader = Titanium.Network.createHTTPClient();
loader.onload = function(data) {
var data = JSON.parse(this.responseText);
var images = [];
for (var c = 0; c < 1; c++) {
images[c] = {
image : data.cover.source,
width : 300
};
}
function square(i) {
var view = Ti.UI.createImageView({
image : images[i].image,
width : 300,
height : 111,
top : 5,
});
return view;
}
for (var i = 0; i < 1; i++) {
scrollView.add(square(i));
}
}
callback(scrollView);
loader.open("GET", url);
loader.send(data);
}
그래서 내가 오류가 기능 및/또는 콜백에 있어야한다는 생각이다.
이미지는 'scrollView'에 있습니다.
나는 함수와 calbacks 앞뒤로 올 때 총 난장판이다.
Script Error = 'undefined' is not an object (evaluating 'require('image').get.signUpConn')
고맙습니다 :
이
은 내가 오류입니다. 그것은이 대신 할 필요가require('image').get.signUpConn(data, function(scrollView){
imag.setImage(scrollView); // Why do you need this here?
});
, 필요에가 없습니다 :
좋아 .. 내가 이전에 내가이 다시 전달에 정말 나쁜 생각 갔다 그래서 당신은 pls이 나를 도울 수 있다면 어쩌면 내가 어떻게 작동하는지 이해하는 것 말했듯이. 여기 내 tableView 전체 코드입니다. http://pastie.org/5676117 그리고 여기 내 image.js http://pastie.org/5676123 고맙습니다 –
안녕 입니다. 나는 내 이미지를 축소했다 .js : http://pastie.org/5678184 –
좀 더 구체적으로 질문을 구체화하면, 나는 당신이 무엇을 요구하는지 모른다. [콜백] (http://recurial.com/programming/understanding-callback-functions-in-javascript/) 및 [일반적으로 자바 스크립트] (https://developer.mozilla.org/en-javascript/) US/docs/JavaScript/A_re-introduction_to_JavaScript)? –