Reputation: 2434
Does anyone know if we can design our custom UIViews
in Xamarin's storyboards
? I would like to use autolayout
and size classes
for a custom View that I need to develop. I am not much comfortable with Xcode, having been so attached to Xamarin's IB. So I would prefer to design it in Xamarin storyboards
than going for XIB
files. I know we can prototype UITableViewCells
in storyboards, but that is not what I want. I want a standalone custom UIView, with a code-behind class that I can re-use.
Upvotes: 0
Views: 1015
Reputation: 2434
I have found out a way. But it is kind of a hack and will increase bundle size and thus a memory-inefficient way. First add a View Controller to the storyboard and give a class name to create a code behind, say "DummyViewController". Then drag a UIView to DummyViewController and in "properties" pane give "class" name as the name of the Custom View as shown in the image.
A code behind for this View will be created in project folder, MyCustomView inheriting from UIView. Now we can design the view from within XS storyboard with AutoLayout and Size Classes without a separate XIB file.
I do not recommend this unless you really want it to be done this way. Hope Xamarin will come up with a solution to design Custom Views from within XS soon.
Upvotes: 0
Reputation: 9703
I am a bit confused as to what you are asking.
Are you wanting to design XIBs in the Xamarin Designer?
Currently, it is not possible as storyboard's XML and XIB's XML are completely different. But it looks like Xamarin is thinking about supporting it as it is on UserVoice here. So you could vote for it and hope it gets added in.
Another option is to start using Xcode.
Upvotes: 1