I am working with a storyboard, and would like to regenerate the .designer.cs for a custom ViewController to reflect new custom classes I have created for the UITextFields since the custom ViewController was initially defined. I have already edited the storyboard to use the new custom UITextField class ("MyTextField"), but now the .designer.cs file is out of date, showing these Outlets as UITextFields instead of MyTextFields.
This is what I tried:
1) Removed the .designer.cs file from the project
2) Deleted the .designer.cs file and ios/obj folder from the disk.
3) Opened the custom ViewController class in Xamarin Studio.
4) Launched XCode with the storyboard.
5) Clicked on the controls in the custom ViewController, and turned on the Assistant Editor view.
“No Assistant Results” shows in XCode’s Assistant Editor, where I was expecting the custom ViewController.h file to be. What else should I be doing? How can I force Xamarin Studio to regenerate a .designer.cs file that is in sync with the current storyboard file?
Xamarin Studio Version: 4.0.12
Xamarin.iOS Version: 6.4.3.0
XCode Version: 4.6.3
Posts
In case anyone else runs into this issue, this is what I ended up doing to update the generated .designer.cs file for a custom view controller in which I had customized the class of the Outlets, changing them from UITextField to MyTextField:
Backed up MyViewController.cs.
Deleted MyViewController.cs and MyViewController.designer.cs from the project and from disk.
Deleted all bin and obj directories from disk.
Launched Xamarin Studio and verified MyViewController did not appear in the project.
Launched XCode on the storyboard file.
Verified the storyboard was using MyViewController for the Custom Class for the view controller, and MyTextField as the Custom Class for the text fields.
Saved and closed the storyboard.
Switched to Xamarin Studio and opened the newly-generated MyViewController.cs.
Relaunched XCode on the storyboard.
I now had a MyViewController.h file in the Assistant Editor for the view controller. Ctrl-dragged each desired outlet into the .h file, being careful to keep the names of the outlets the same as I had used originally.
Copied the archived MyViewController.cs from step 1 over the version that was generated in step 7.
Ready to use the MyTextField Outlets as intended in MyViewController, because it was in sync with the storyboard and MyViewController.designer.cs.
If anyone knows of a quicker or more effective way to do this, please post.
Hi, so this is how it "works" for me in Xamarin 5.8.2 and how I worked around the problem.
Create the problem:
Try to solve the problem:
None of these solves the problem, sometimes they work, most of the times they don't.
Workaround:
This always works for me... but is nonsense.
+1 Laurie. But the existing outlets were deleted...
This work for me:
I found that, if you do:
1. Open .xib file
2. Change the VIEW AS option. For example, Generic -> iPhone, iPad...
The .design.cs file will be updated automatically.