Hi folks,
Hopefully a quick one here.
I've got an app which is almost ready for deployment, but got a small issue i'd like to fix.
I'm using the picture gallery from GitHub here:
https://github.com/novelys/titanium-picture-gallery
What i'd like to do is when i tap the 'Gallery' tab in my app (i have 5 tabs) it just displays the gallery rather than sliding in another view.
Here is my code
// Import ImageGallery module Ti.include('picturegallery.js'); var win = Ti.UI.currentWindow; // Array with image objects var images = [ {path:'images/gallery/6140896705_764cc2ea1b_b.jpg'}, {path:'images/gallery/6140901809_43dac28631_b.jpg'}, {path:'images/gallery/6140905807_f3f8af6462_b.jpg'}, {path:'images/gallery/6140915401_9bf8333368_b.jpg'}, {path:'images/gallery/6141441964_db25726150_b.jpg'}, {path:'images/gallery/6141462074_bcce6f4bb7_b.jpg'}, {path:'images/gallery/6141473268_76c4bae7c1_b.jpg'}, {path:'images/gallery/6504224621_df3e313f7d_b.jpg'}, {path:'images/gallery/6504225605_78056e5b56_b.jpg'}, {path:'images/gallery/6504226565_bfafc0e8ec_b.jpg'}, {path:'images/gallery/6504238863_b29558668b_b.jpg'}, {path:'images/gallery/6504239477_b802262828_b.jpg'}, {path:'images/gallery/6504240417_32b7425f45_b.jpg'}, {path:'images/gallery/6504240901_cd8724d30f_b.jpg'}, {path:'images/gallery/6140901809_43dac28631_b.jpg'}, {path:'images/gallery/6504241525_de9c4f57c1_b.jpg'}, {path:'images/gallery/6504242077_58c4395941_b.jpg'}, {path:'images/gallery/6713350557_37f947471e_b.jpg'}, {path:'images/gallery/6713351187_f6a9c7f5ea_b.jpg'}, {path:'images/gallery/6713352043_301e553994_b.jpg'}, {path:'images/gallery/6713353047_217609975d_b.jpg'}, {path:'images/gallery/6839418028_9b5ccf62cd_k.jpg'}, {path:'images/gallery/6839421124_f80fe201cb_k.jpg'}, {path:'images/gallery/6839429542_4c60f5fd7b_k.jpg'}, {path:'images/gallery/6839434524_378db23f53_k.jpg'}, {path:'images/gallery/6839437820_6aa26a1723_k.jpg'}, {path:'images/gallery/6839445692_3b4cdb81f1_k.jpg'}, {path:'images/gallery/6839448462_38c2518eed_k.jpg'}, {path:'images/gallery/6985546863_1d5e969ae0_k.jpg'} ]; var pictureGallery = PictureGallery.createWindow({ images: images, windowGroup: Titanium.UI.currentTab, title: 'Gallery', thumbGallery: { numberOfColumnPortrait: 4, numberOfColumnLandscape: 5, thumbSize: 120, thumbBorderColor: '#555', thumbBorderWidth: 0, thumbBackgroundColor: 'transparent', backgroundColor: 'transparent' } }); Titanium.UI.currentTab.open(pictureGallery);Any help would be greatly appreciated!
I've also got an app crash, caused I think by a memory leak. This doesn't happen on the simulator, only the device. That's for another post!
Simon
2 Answers
My guess is that you need to pass in the actual tabGroup into the method, so try this.
var tab5 = Titanium.UI.createTab({ icon:'images/121-landscape.png', title:'Gallery', window:win5, _tabGroup : tabGroup });then when creating the photoGallery
var pictureGallery = PictureGallery.createWindow({ images: images, windowGroup: Titanium.UI.currentTab._tabGroup, // PASS IN TABGROUP title: 'Gallery', thumbGallery: { numberOfColumnPortrait: 4, numberOfColumnLandscape: 5, thumbSize: 120, thumbBorderColor: '#555', thumbBorderWidth: 0, thumbBackgroundColor: 'transparent', backgroundColor: 'transparent' } });
Did you ever get this to work? I'm currently having the same problem.
Your Answer
Think you can help? Login to answer this question!