Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Using same image view in parent and child window

$
0
0

I have a scrollableview with images in a parent window, and by clicking on the scrollableview i open a new window showing the scrollableview again in fullscreen. This works all well, but when i close the child window, the image has disappeared from the parent's windows scrollable view.

I'm testing this on an iPhone.

What could be the cause of the image disappearing, and what is the best way to prevent this from happening? I'm grateful for any hint into the right direction.

Here is the relevant code i'm using:

// Add image view for usage in fullpage ScrollableView
    var img = Ti.UI.createImageView({
            image:'image1.jpg',
            width:500,
            height:400,
        top:0,
            left:0  
    }); 
 
    // Add image view wrappers for allowing zoom of image views
    var imgWrapper = Ti.UI.createScrollView({
            width:500,
            height:400,
            maxZoomScale: 3,
            minZoomScale: 1,
            top: 0,
            zoomScale: 1
    });
    imgWrapper.add(img);    
 
    // Add scrobalbeView for the images
    var scrollView = Titanium.UI.createScrollableView({
            views:[img],
        height: '60%',
        showPagingControl:true,
        pagingControlHeight:30,
        currentPage:0
    });
    // Add a click events listener to open up a fullscreen view the image scrollview
    scrollView.addEventListener('click', function(e){   
 
        // Create the scrollable view for the fullscreen image scroll
        var scrollViewFull = Titanium.UI.createScrollableView({
            views:[imgWrapper],
            height: 400,
            width:  500,
            currentPage:clickedimage
        });
 
        // Create new window to contain the fullpage scrollViewFull
        var viewFullWindow = Ti.UI.createWindow({
                title:'Full Screen',
                fullscreen:true
        });
        // Create nav window wrapper to allow the use of a navigation menu on a modal window
        var navWin = Ti.UI.iOS.createNavigationWindow({
            modal: true,
            window: viewFullWindow,
            orientationModes: [Ti.UI.LANDSCAPE_RIGHT, Ti.UI.LANDSCAPE_LEFT]
        });
 
        // Create  close button to the nav menu
        var closeButton = Titanium.UI.createButton({systemButton:Titanium.UI.iPhone.SystemButton.DONE});
        // Add  close button to the nav menu
        viewFullWindow.rightNavButton = closeButton;
        // Add eventlistener for close button to close the window when clicked
        closeButton.addEventListener('click', function() {
            navWin.close(); 
        });

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>