Reputation: 742
Is there an equivalent of R.drawable. on monotouch? I'm also searching for a way to set an xml graphic resource definition as background of a UIView or subclasses.
Upvotes: 1
Views: 133
Reputation: 26495
You are in a different world here. iOS does not have an equivalent of what you're using on Android.
General practice is to use a static class in MonoTouch:
public static class Resources
{
public static readonly UIImage Background = UIImage.FromFile("Background.png");
}
And use this anywhere you need it from C# code. If you set an image in a XIB file, it will use UIImage.FromBundle()
, which caches the image across views. UIImage.FromFile()
is generally better when using it from a static class, however.
See more on UIImage loading and MonoTouch here: http://docs.xamarin.com/ios/tutorials/Working_with_Images?highlight=images (near bottom)
Upvotes: 1