O'Reilly logo

Xamarin Blueprints by Michael Williams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the CustomImageRenderers

We are going to start with the iOS implementation of the CustomImage. Inside the Renderers folder, add a new folder called CustomImage, add a new file called CustomImageRenderer.cs, and implement the following:

public class CustomImageRenderer : ViewRenderer<CustomImage, UIView> 
    { 
        #region Private Propertie 
 
        private readonly string _tag; 
 
        private ILogger _log; 
 
        private UIImageView _imageView; 
 
        private int _systemVersion = Convert.ToInt16 (UIDevice.CurrentDevice.SystemVersion.Split ('.') [0]); 
 
        #endregion 
 
        #region Constructors 
 
        public CustomImageRenderer() 
        { 
            _log = IoC.Resolve<ILogger>(); 
            _tag = string.Format("{0} ", GetType()); 
        } 
 
        #endregion 
} 

Looking at our private properties, we have the logging objects again, an integer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required