以下は私のコードです...私が抱えている問題は、iPhoneデバイスからカメラで写真を撮ったときに、labelviewがimageviewの後ろに隠れる可能性があることです...
var win = Titanium.UI.createWindow({
title : 'Photoshare',
fullscreen : false,
barColor : '#000000',
backgroundColor : '#fff'
});
// creating scroll view
var scrollView = Titanium.UI.createScrollView({
contentWidth : 'auto',
contentHeight : 'auto',
width : Titanium.Platform.displayCaps.platformWidth,
height : Titanium.Platform.displayCaps.platformHeight,
top : 0,
showVerticalScrollIndicator : false,
showHorizontalScrollIndicator : false,
minZoomScale : 0.1,
maxZoomScale : 100
});
// creating parent view to contain imageview
var parentView = Titanium.UI.createView({
width : Titanium.Platform.displayCaps.platformWidth,
height : Titanium.Platform.displayCaps.platformHeight,
top : 0
});
scrollView.add(parentView);
// adding parent view to window
// win.add(parentView);
// creating image view
var imgView = Titanium.UI.createImageView({
width : Titanium.Platform.displayCaps.platformWidth,
height : Titanium.Platform.displayCaps.platformHeight,
top : 0
});
// adding imageview to parent view
parentView.add(imgView);
var labelView = Titanium.UI.createView({
top : 280,
right : 0,
width : 200,
height : 100,
backgroundColor : '#000',
opacity : 0.5
});
imgView.add(labelView);
// opening the camera at the start of the app
Titanium.Media.showCamera({
saveToPhotoGallery : false,
allowEditing : false,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
success : function(event) {
var capturedImage = event.media;
imgView.image = capturedImage;
},
cancel : function() {
scrollView.hide();
},
error : function(error) {
if (error.code == Titanium.Media.NO_CAMERA) {
alert('Please Run it on device');
}
},
});
var currentLocationLabel = Titanium.UI.createLabel({
left : 5,
// top : 2,
width : 'auto',
height : 15,
color : '#fff',
font : {
fontSize : 12
},
});
// labelView.add(currentLocationLabel);
var previousLocationLabel = Titanium.UI.createLabel({
left : 5,
// top : 66,
width : 'auto',
height : 15,
color : '#fff',
font : {
fontSize : 12
},
});
var distanceLabel = Titanium.UI.createLabel({
left : 5,
// top : 50,
width : 'auto',
height : 15,
color : '#fff',
font : {
fontSize : 12
},
});
var timeLabel = Titanium.UI.createLabel({
left : 5,
// top : 18,
width : 'auto',
height : 15,
color : '#fff',
font : {
fontSize : 12
},
});
var weatherLabel = Titanium.UI.createLabel({
left : 5,
// top : 34,
width : 'auto',
height : 15,
color : '#fff',
font : {
fontSize : 12
},
});
win.addEventListener('focus', function(e) {
var setTop = 2;
/* if (Ti.App.DataStorage.GetPreviousLocationVisibility() == 0) {
labelView.remove(previousLocationLabel);
} else {
labelView.add(previousLocationLabel);
}*/
if (Ti.App.DataStorage.GetCurrentLocationVisibility() == 0) {
labelView.remove(currentLocationLabel);
} else {
currentLocationLabel.setTop(setTop);
labelView.add(currentLocationLabel);
setTop = setTop + 15;
}
if (Ti.App.DataStorage.GetTimeVisibility() == 0) {
labelView.remove(timeLabel);
} else {
timeLabel.setTop(setTop);
labelView.add(timeLabel);
setTop = setTop + 15;
}
if (Ti.App.DataStorage.GetWeatherVisibility() == 0) {
labelView.remove(weatherLabel);
} else {
weatherLabel.setTop(setTop);
labelView.add(weatherLabel);
setTop = setTop + 15;
}
if (Ti.App.DataStorage.GetDistanceVisibility() == 0) {
labelView.remove(distanceLabel);
} else {
distanceLabel.setTop(setTop);
labelView.add(distanceLabel);
setTop = setTop + 15;
}
});
誰でも私が間違っていることを教えてくれます...助けが必要です