Forum Xamarin.iOS

Textfield Leftview image xamarin ios

guru_vijayguru_vijay Member ✭✭

how to set textfield leftview image from the resource folder

Best Answer

  • guru_vijayguru_vijay ✭✭
    Accepted Answer

    var imageView = new UIImageView(UIImage.FromBundle("xyz.png"))
    {
    // Indent it 10 pixels from the left.
    Frame = new RectangleF(10,0,20,20)
    };

    UIView objLeftView = new UIView(new Rectangle(0,0,30,20));
    ojLeftView.AddSubview(imageView);

    objUITextField.LeftViewMode = UITextFieldViewMode.Always;
    objUITextField.LeftView = objLeftView;

Answers

  • guru_vijayguru_vijay Member ✭✭
    Accepted Answer

    var imageView = new UIImageView(UIImage.FromBundle("xyz.png"))
    {
    // Indent it 10 pixels from the left.
    Frame = new RectangleF(10,0,20,20)
    };

    UIView objLeftView = new UIView(new Rectangle(0,0,30,20));
    ojLeftView.AddSubview(imageView);

    objUITextField.LeftViewMode = UITextFieldViewMode.Always;
    objUITextField.LeftView = objLeftView;

Sign In or Register to comment.