Using custom components in Cappuccino with Interface Builder - cappuccino

I know that in Cocoa, in order to use custom component in Interface Builder I should go to property inspector panel and change, say, my standard NSView to the custom one.
Is there any solution for using custom components in Cappuccino while laying out components in Interface Builder?

You can do the exact same thing.
You have your CPSupaView, you just drop a view in IB and you change the class name to CPSupaView.

Related

Custom view in Object Library and IB compatible in Xcode?

I have a control in one of my storyboard that I copy in a lot of screen and even projects. It's just native controls with stack view, scroll views, labels, etc placed with auto-layout already wired together.
Is there a way to add this into the Object Library in Xcode so I can just drag it from there onto my storyboard and still see all the native controls? I want to be able to drag and drop other controls into the stack view and even modify it from there within IB.
I do not want to do this programatically because I want to continue using Interface Builder for my custom control.
s there a way to add this into the Object Library in Xcode so I can just drag it from there onto my storyboard and still see all the native controls?
No. The usual strategy is to keep it in a xib file (so you are using Interface Builder to construct the view complex) and load the nib programatically to get at the view and put it in the interface at runtime. To some extent you can automate that programmatic process by means of a view subclass that loads its own content from the nib.
Or, if this view has different manifestations in different contexts, you might just have to use copy and paste of some template version (presumably you’re already doing that).

IBDesignable controls and Cocoa bindings

Having created an IBDesignable control for use in Interface Builder, it looks like Cocoa bindings are only available for its "Hidden" property and Tooltip parameter. Am I missing something here? Is it not possible to bind the control's value?
The two bindings exposed by NSControl are in fact inherited from NSView - NSControl itself exposes no additional bindings. Apple provides information about all available bindings in its Introduction to Cocoa Bindings. If you want to use bindings within your control you should consider adding more specialized subviews to the control (e.g. NSTextField, NSImageView) and exploiting their bindings.

Xamarin - Custom Renderer - cast Form.View to Android.View

Is it possible to get Android.View (and equivalent view object in iOS) from Xamarin.Form.View? I have custom control which takes dependencies to Android.View. I am writing custom renderer which would set that custom control as native view but I need to convert my ContentView (exposed as BindableProperty, initialized in xaml) from Portable library to Android.View.
Yes you can. I have written an extension that uses reflection to get the underlying native view:
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms.Droid/Extensions/ViewExtensions.cs#L54-L59
Native view in the code is Android.Views.View type and View is Xamarin.Forms.View.
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/src/Forms/XLabs.Forms.Droid/Extensions/ViewExtensions.cs#L19
The same works for iOS as well, just cast it to UIView.

Unclear xcode interface builder feature - Beginner

When one uses the Interface Builder to arrange the UI Components, there is an option where you have to click to resize or arrange all UI components (buttons, labels, etc.) to fit the view. What is this feature called? And how can you do this programmatically?
I think you are referring to the autoresizingMask property for a UIView.
Have a look at the documentation

Is it possible to make a subclass of NSObject which support subnodes in IB for iPhone project?

I'm making a custom UI element class for iPhone.
It'll cool to edit my class on Interface Builder with hierarchy.
Some of my class is management class like UINavigationController, but they're not one of them, subclassed from NSObject.
Of course, I can place a NSObject instance on IB, but it cannot have a child node.
Is there a way to enable adding child node to subclass of NSObject?
You can make a plug-in for Interface Builder. See here, or, more specifically, here.
Matt Gallagher also has a nice tutorial here.
Now, these links all pertain to Mac. I honestly am not sure if the same principles apply to iPhone.

Resources