Randonee / BasisApple

Native Apple application development with haxe
39 stars 4 forks source link

UIImage resizableImageWithCapInsets issue #3

Open wwwins opened 11 years ago

wwwins commented 11 years ago

Hi Aaron,

I am trying to play with the UIImage and UIImageView.

Simple code:

var imageView:UIImageView = new UIImageView();
var panelImage:UIImage = UIImage.imageWithData(NSData.dataWithContentsOfFile( IOSUtil.getAssetPath("haxe.png") ));
imageView.image = panelImage.resizableImageWithCapInsets([10.0, 16, 10, 16]); // crash
imageView.frame = [20, 20, 200, 150];
addSubview(imageView);

But when i tried to set resizableImageWithCapInsets, i got this error.

[DEBUG] 2013-08-02 15:23:55.939 Example[90468:11f03] -[NSNull _isResizable]: unrecognized selector sent to instance 0x2592678
[DEBUG] 2013-08-02 15:23:55.941 Example[90468:11f03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _isResizable]: unrecognized selector sent to instance 0x2592678'
*** First throw call stack:
(0x2461012 0x17dce7e 0x24ec4bd 0x2450bbc 0x245094e 0x8127ab 0x469ae9 0x24551bd 0x24550d6 0x8e86 0x1a4abe 0x17e352 0x157fa5 0x9b474 0x1681c2 0x163e09 0x161c49 0x15118d 0x152048 0x161c49 0x175cb1 0x1aaf24 0x237e 0x51b8 0x6abc 0x3ad5db 0x3a589d 0x24551bd 0x24550d6 0x8e86 0x1a4abe 0x17e352 0x157fa5 0x12fea0 0x16b7a5 0x169e69 0x161c49 0x15118d 0x152048 0x161c49 0x175cb1 0x1aaf24 0x237e 0x51b8 0x6abc 0x3ad5db 0x3a589d 0x25d3 0x1a4e1e 0x17e0d2 0x154137 0x162f67 0x15bb97 0x2070 0x4ff2 0x35c157 0x35c747 0x35d94b 0x36ecb5 0x36fbeb 0x361698 0x23bcdf9 0x23bcad0 0x23d6bf5 0x23d6962 0x2407bb6 0x2406f44 0x2406e1b 0x35d17a 0x35effc 0x247a 0x1aaaa7 0x17e048 0x15ba19 0x9aef 0x17f303 0x1f95 0x1f15 0x1)
libc++abi.dylib: terminate called throwing an exception
[DEBUG]

Any idea?

Randonee commented 11 years ago

This is probably happening because that method is returning a UIImage which has not been added to the objectManager. It should be possible to add any object returned by a method automatically. I'll look at at fixing it after the weekend.