I am trying to do this to set a tiled image as my views background
self:view():setBackgroundColor(UIColor:colorWithPatternImage(UIImage:imageNamed("Images/leather.png")))
I did not receive an error but the background on the view does not change.
So I tried this
local filename = "Images/leather.png"
print("loading image @ "..filename)
local image = UIImage:imageNamed(filename)
if not image then
print("image failed to load!")
end
And this printed Image failed to load! so I tried "|D|Images/leather.png" and "|R|Images/leather.png" still with no luck.
@bowerandy is this the correct way to do this?
How would I set a UIImage to an image file inside my Gideros Project
Any help appreciated
Comments
The image you have will be in |R| (if it is included in the Gideros project itself). However, this |R| is a Gideros only naming convention. To convert this to a real full iOS path I have included a function in the original plugin called, getPathForFile(). Try using this to expand the filename you pass to the UIImage.
If this doesn't work, it might be that UIImage can only load files that are built in to the application resource bundle. I know some Cocoa component can only do this, let's hope UIImage isn't one of them.
best regards
Likes: nextgamevertex
Here's an example. It doesn't create a tiled background texture, but instead populates an UIImageView.
The demo code is now in an updated version of the BhWax repository.
best regards
Sorry about the slow response, hadn't been on the forums.
Wow awesome, that works perfectly.
I can't thank you enough I would've been stuck on this for hours.