Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

View to imageView

I have a view and I want to convert it to a new imageView.
I am using view.toImage() although this only gives me a blob.

Here is my code:

var win1 = Titanium.UI.createWindow(
{
    backgroundColor: '#fff'
});
var view = Ti.UI.createView({
        BackgroundColor: "red"
});
win1.add(view.toImage());

This gave me an error that says type mismatch.
Thanks ahead for the help.

— asked September 16th 2010 by Aidan Grant
  • imageview
  • mobile
  • thanks!
  • view
0 Comments

2 Answers

  • Found the answer-Thanks!

    var image = Ti.UI.createImageView({
       image:view.ToImage()
    });
    win1.add(Image());
    
    — answered September 16th 2010 by Aidan Grant
    permalink
    1 Comment
    • Here is the bugfixed code:

      var image = Ti.UI.createImageView({
         image:view.ToImage()
      });
      win1.add(image);
      

      — commented November 8th 2011 by Kristof Gruber
  • var image = Ti.UI.createImageView({
       image:view.ToImage()
    });
    win1.add(image);
    
    — answered November 17th 2011 by Gagan Tiwari
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.