Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Creating a new file of type Monotouch/iPhone View does not create designer files.
If I create a new file in my project of type 'iPhone View', the XIB is created but no designer.cs file is created. Hence when I click on the XIB to edit, I can't create outlets in XCode 4 because there is no .h file.
If I do the same but create a new file with type 'iPhone View Controller', the designer.cs file is created and everything works OK.
If you have a work-around it would be very useful.
This is by design. In Xcode 4, xibs cannot define custom classes, so xibs no longer have designer files. Xcode reads type information from Objective-C source instead. Therefore, MD syncs to Xcode all the classes that would be visible to Objective-C. That means that these *classes* have designer files.
You have created a view defined in a xib. A xib is simply a serialized object graph, and the view in the template doesn't use or define any custom types.
If you want to give your view object in the xib a custom class, define the class in MD and register with the obj-C runtime, e.g.
class MyView : UIView
Then, when you open the xib in Xcode again, the MyView type will be visible, and you can look at the UIView in the xib and set its custom class to MyView.
You can do this for all widgets in the xib. The only reason the UIViewController template creates a custom class for the view controller by default is that a view controller needs to be a custom class of some kind. However, views don't need to be custom types - for example, you might set the xib File's Owner to some existing view controller type, and connect the view's widgets to the controller's outlets.
Thanks, that is very helpful, excellent explanation. I really like the way that works.