Bug 4790 - Add a new class based on a UIView. The backing .xib.cs file is not created.
Summary: Add a new class based on a UIView. The backing .xib.cs file is not created.
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-05-01 04:27 UTC by Matt Jones
Modified: 2013-12-05 18:35 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Matt Jones 2012-05-01 04:27:58 UTC
Add a new class based on a UIView. The backing .xib.cs file is not created. It happens on existing (ancient) projects and brand new ones.

If you make the backing file manually (and include the [Register] attribute!) then all is well and you can then add outlets etc in XCode.
Comment 1 Mikayla Hutchinson [MSFT] 2012-05-01 14:02:46 UTC
Not sure what you're asking for, .xib.cs file no longer exist, they date back to when xib files defined classes, in Interface Builder 3.

For an explanation of the Xcode 4 designer model, please see http://stackoverflow.com/questions/7698167/monodevelop-2-8-xcode-3-2-6-interface-builder-outlets-and-actions/7704521#7704521

Note that to make the accessible from Obj-C (and show up in Xcode) you need the {Register("SomeName")], but it can be on any class part, it doesn't have to be on the designer class part. And the xcode integration will create the .designer.cs file as needed, if you add outlets/attributes in Xcode 4.x.

Does this help?
Comment 2 Matt Jones 2012-05-02 04:32:12 UTC
My mistake to call it .xib.cs, sorry. I'm aware of the new setup.

However, what I'm saying here is that if I create a new view in my project, just the .xib is created - I have to create the rest by hand, as the associated .cs files are not created nor added to the project.

If I create a new view controller, this is not the case - an associated .cs file and a designer.cs file are both created and added to the project.

Is this expected behaviour?
Comment 3 Mikayla Hutchinson [MSFT] 2012-05-02 13:11:40 UTC
Yes, it is. Xibs are serialized object graphs. The view template is simply a template for a xib that contains a UIView object. It's not a custom subclass, not is it connected to an outlet on a custom class. So there is no backing class.

It's a simple basis for doing more complicated things. For example, you could connect it to an outlet of an existing view controller - a single view controller can load different views. Or you could deserialize it directly using the bundle API. Or, you could set it to be a custom UIView subclass, and define that class in code.

For the common case, there's the "view with controller" template, which has a custom controller class, and a UIView xib connected to the view outlet on the controller.
Comment 4 PJ 2013-11-19 17:05:24 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 5 PJ 2013-12-05 18:35:44 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.