How to display elements added programmatically on a storyboard?

handsuphandsup Member ✭✭
edited January 22 in Xamarin.iOS

Hello everyone!
I have started learning Xamarin.iOS and tried adding a Search Bar element via Storyboards, and programmatically within a default ViewController class. I am struggling to understand why when I code the Search Bar instead of dragging and dropping it as outlined in the Microsoft documentation (code below), I am unable to see it on a storyboard.

       `searchBar = new UISearchBar(){
                Placeholder = "Enter your search Item",
                Prompt = "Search Entered here",
                ShowsScopeBar = true,
                ScopeButtonTitles = new string[]{ "Boston", "London", "SF" },
        };`

What settings do I need apply to be able to see my hard coded elements on a Storyboard?

In terms of project structure, I just launched a default Single Page iOS template provided in Visual Studio, pasted the code into the ViewController class created by default and then tried to look for the element to appear on Main.storyboard. I understand that maybe perhaps I haven't set any kind of settings that allows the storyboard to see the "backend" ViewController code.

Any help would be much appreciated! Thanks!

Tagged:

Best Answer

Answers

  • handsuphandsup Member ✭✭

    Thank you @ColeX !

Sign In or Register to comment.