Titanium Community Questions & Answer Archive

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

createImageView() on iPhone simulator throws serious error - it's killing me!

Using Titanium Developer 1.2.1, Titanium SDK 1.4.2, iOS SDK 4.2

Trying to get an Image View to pull in an image - should be simple, right?

root.js file is Resources/windows/ and
snowperson.png file is in Resources/images/

Using a relative path in this bit of code within root.js:

var windowCurrent = Ti.UI.currentWindow;
...
var viewSnowPerson = Ti.UI.createImageView(
{
    image:'../images/snowperson.png',
    top:0,
    width:50,
    height:50
});
...
windowCurrent.add(viewSnowPerson);

Throws up this error:

[ERROR] Failed to load image: ../images/snowperson.png – file://localhost/windows/root.js, Error: Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x6827040 {NSUnderlyingError=0x683b8c0 "The operation couldn’t be completed. Connection refused", NSLocalizedDescription=A connection failure occurred}

— asked December 1st 2010 by Gary Crook
  • createimageview
  • iphone
  • mobile
0 Comments

2 Answers

  • Accepted Answer

    take a look at this thread I think it will give you some options

    http://developer.appcelerator.com/question/83211/images-on-iphone

    — answered December 2nd 2010 by Aaron Saunders
    permalink
    1 Comment
    • That fixed it! Answer was not to use absolute path with preceding slash in Ti.UI.createWindow url property.

      — commented December 2nd 2010 by Gary Crook
  • Great, I'll take a look - sounds like it's what I'm after.

    Thanks Aaron.

    — answered December 2nd 2010 by Gary Crook
    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.