Increase SearchBar TextField height in Xamarin Native iOS

31 Views Asked by At

I am having an app in which I want to increase my searchbar height.

I know it's a small thing with lots of ideas here but none of them seems to work for me in Xamarin Native iOS.

I am able to increase the height of SearchBar not the Textfield inside it.

This is my code:

mSearchBar.HeightAnchor.ConstraintEqualTo(84.0f).Active = true;

public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            mSearchBar.LayoutSubviews();
            mSearchBar.LayoutIfNeeded();

            UITextField searchTextField = (UITextField)mSearchBar.ValueForKey(new NSString("searchField"));
            searchTextField.HeightAnchor.ConstraintEqualTo(84.0f).Active = true;
            
            searchTextField.LayoutSubviews();
            searchTextField.SetNeedsLayout();
            searchTextField.LayoutIfNeeded();
        }

What can I try to resolve this?

0

There are 0 best solutions below