Skip to content

Instantly share code, notes, and snippets.

@codersatx
Created May 20, 2011 04:04
Show Gist options
  • Save codersatx/982328 to your computer and use it in GitHub Desktop.
Save codersatx/982328 to your computer and use it in GitHub Desktop.
The code for the paintings tab in the Garcia Mobile fine art iPhone app.
var win = Titanium.UI.currentWindow;
//Used when zooming into images.
var animation = Titanium.UI.createAnimation();
animation.duration = 500;
var infoText = Titanium.UI.createLabel({
text:win.fullDescription,
color:'#fff',
font:{fontSize:15, fontWeight:'normal'},
width:'300',
height:'auto',
top:10,
shadowColor:'#000',
shadowOffset:{x:1,y:1}
});
var sv = Titanium.UI.createScrollView({
contentWidth:'auto',
contentHeight:'auto',
top:0,
showVerticalScrollIndicator:true,
showHorizontalScrollIndicator:true
});
sv.add(infoText);
var infoWin = Titanium.UI.createWindow({
backgroundImage:'../images/bg-window.png',
barColor:'#000',
title:win.imageTitle + ' Info',
height:'auto',
width:'auto'
});
infoWin.add(sv);
var btnClose = Titanium.UI.createButton({
title:'Back',
style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN
});
btnClose.addEventListener('click',function()
{
infoWin.close();
});
infoWin.setLeftNavButton(btnClose);
var btn_info = Ti.UI.createButton({
title: "More Info...",
selectedColor: '#99B7DF',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
win.rightNavButton = btn_info;
var imageView = Titanium.UI.createImageView({
url:win.imageFile,
width:'280',
height:'auto',
top:15,
borderColor:'#fff',
borderWidth:3
});
win.add(imageView);
var l = Titanium.UI.createLabel({
backgroundColor:'#000',
text:win.imageDetail,
bottom:0,
opacity:'.7',
color:'#fff',
height:40,
width:320,
textAlign:'center'
});
imageView.addEventListener('click',function(e){
if (l.opacity==0)
{
animation.opacity = '.7';
l.animate(animation);
l.opacity = '.7';
win.showNavBar();
}
else
{
animation.opacity = '0';
l.animate(animation);
l.opacity = '0';
win.hideNavBar();
}
});
btn_info.addEventListener('click', function(e){
Titanium.UI.currentTab.open(infoWin,{animated:true});
});
win.orientationModes = [ Titanium.UI.PORTRAIT,Titanium.UI.UPSIDE_PORTRAIT, Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment