Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to use CustomRenderer with CustomUIView

$
0
0

Could anyone give me some hint about how to use a iOS custom UIView like https://github.com/gshackles/JVFloatSharp in CustomRenderer.

[assembly: ExportRenderer (typeof (JVFloatLabeledEntry), typeof (JVFloatLabeledEntryRenderer))]
namespace DutyFreeCollection.iOS
{
    public class JVFloatLabeledEntryRenderer : JVFloatLabeledTextField // What class shoud I inherit?
    {
        public JVFloatLabeledEntryRenderer (RectangleF frame)
        {                   

            const float JVFieldHeight = 44.0f;
            const float JVFieldHMargin = 10.0f;
            const float JVFieldFontSize = 16.0f;
            const float JVFieldFloatingLabelFontSize = 11.0f;

            UIColor floatingLabelColor = UIColor.Gray, floatingLabelActiveColor = UIColor.Blue;

            Placeholder = "Specific Location (optional)";
            Font = UIFont.SystemFontOfSize (JVFieldFontSize);
            FloatingLabelFont = UIFont.BoldSystemFontOfSize (JVFieldFloatingLabelFontSize);
            FloatingLabelTextColor = floatingLabelColor;
            FloatingLabelActiveTextColor = floatingLabelActiveColor;
        }
}
  1. What class should JVFloatLabeledEntryRenderer inherit from?
  2. JVFloatLabeledTextField doesn't have a ctor with 0 argument, but a CustomRenderer needs a ctor with 0 argument to be used.

Thank you very much.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>