Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set image after NappImageView.createImageView method #9

Open
designbymind opened this issue Nov 9, 2015 · 0 comments
Open

Set image after NappImageView.createImageView method #9

designbymind opened this issue Nov 9, 2015 · 0 comments

Comments

@designbymind
Copy link

Hi @viezel,

Thanks so much for the awesome module!

Just wondering if there is currently a method of setting the 'image' property after an NappImageView has already been both created and bound to another view or window?

Currently I'm trying to capture a photo with the camera and use the returned media blob to set the image of a NappImageView element...

Example:

var NappImageView = require('dk.napp.imageview');

var camera_view = SquareCamera.createView({
    height : Ti.UI.FILL,
    width : Ti.UI.FILL,
    backgroundColor : "#000000",
    frontQuality : SquareCamera.QUALITY_HIGH,
    backQuality : SquareCamera.QUALITY_HD,
    camera : "back"
});

var image_preview = NappImageView.createImageView({
    height : 300,
    width : 300,
    bubbleParent : false,
    backgroundColor : "transparent",
    preventDefaultImage : true,
    zIndex : 1,
    contentMode : NappImageView.CONTENT_MODE_CENTER,
    clipsToBounds : true
    //image : "http://designtoimprovelife.dk/wp-content/uploads/2011/03/nyhavn.jpg"
});

window.add(camera_view);
window.add(image_preview);

camera_view.addEventListener("success", function(event) {
    image_preview.setImage(event.media);
    //or
    //image_preview.image = event.media;
});

Note: this example uses the SquareCamera module by mikefogg, but as you know, the native camera API returns the same (blob)

If you get some time, I'd love to hear your thoughts 😃

· Jason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant