Cannot reference components like buttons placed in Viewcontrollers placed in Storyboard

OnedayOneday GBMember ✭✭
edited July 10 in Xamarin.iOS

Hi All

I have difficulty doing something as simple as;

Some_label.Text = "xx" ;

The code above is in the ViewController cs file, and the "Some_label" is not coming up in intellisense, and causes compile error if I type it in anyway.

Where some_label is a label placed in a ViewController dragged onto a storyboard from the toolbox.
The storyboard in question is a secondary storyboard linked to the Main.storyboard by a storyboard reference.

I eventually get it to work afer a lot of fiddling around, re building, cleaning, then it sometimes works.
Yet, I cannot isolate what I did that made it work cos when I repeat my steps, it doesn't happen the same way.

I have determined that when I put the viewcontroller in a sub namespace such as

Topnamespace.subnamespace
It definitely fails, even if it were working before, yet, when I place a new ViewController in the top namespace it fails

I hope this makes sense, can anyone suggest a possible cause, guide me in the right direction ?

Cheers

Best Answer

Answers

  • OnedayOneday GBMember ✭✭

    Thanks LandLU, For some reason, it only works if I do it the way you describe.

    If I generate a ViewController independently of the Storyboard, it does not work,

Sign In or Register to comment.