title: Xamarin: How to load image from iOS library project
body: <p>I have a Xamarin Project styled with MvvmCross. There are Subprojects:</p>
  
  <ul>
  <li>Core (PCL)</li>
  <li>ViewModel (PCL)</li>
  <li>iOS (Executable)</li>
  </ul>
  
  <p>If i add an image to my iOS project (Resoureces/Images/test_image.png), then i can load it with this code:</p>
  
  <pre><code>UIImage image = UIImage.FromBundle("Images/test_icon.png");
  </code></pre>
  
  <p>Now, i want to use a new Subproject </p>
  
  <ul>
  <li>Controls (iOS Library)</li>
  </ul>
  
  <p>This library should load an image. I added an image to Controls (Resoureces/Images/test_image.png)</p>
  
  <p>But i can not load this image in Controls proj.</p>
  
  <p>My Question: How to load images from iOS libraries?</p>
  
  <pre><code>    public class MyButton : UIButton
      {
          public MyButton () : base()
          {
              Initialize ();
          }
  
          void Initialize()
          {
              // load image from bundle
              UIImage image = UIImage.FromBundle("Images/test_icon.png");
              // image is null
              this.SetImage (image, UIControlState.Normal);
          }
      }
  </code></pre>
  
  <p>and the ViewController class is : </p>
  
  <pre><code>    public partial class FirstView : MvxViewController
      {
          public FirstView () : base ("FirstView", null)
          {
          }
  
          public override void ViewDidLoad ()
          {
              base.ViewDidLoad ();
  
              // load image from bundle
  //          UIImage image = UIImage.FromBundle("Images/test_icon.png");
  //          image is not null if added in iOS Proj
  //          this.imageView.Image = image;
  
              MyButton button = new MyButton ();
  
              View.Add (button);
  
              View.AddConstraint (NSLayoutConstraint.Create (button, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, 10));
              View.AddConstraint (NSLayoutConstraint.Create (button, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, 74));
              View.AddConstraint (NSLayoutConstraint.Create (button, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0, 64)); 
              View.AddConstraint (NSLayoutConstraint.Create (button, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0, 64)); 
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LHMKO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LHMKO.png" alt="enter image description here"></a></p>
  
  <p>Here is full proj: <a href="https://bitbucket.org/ww_wschaefer/xamarin-first-crossover-app/overview" rel="noreferrer">https://bitbucket.org/ww_wschaefer/xamarin-first-crossover-app/overview</a></p>