Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

CustomRenderer SubView vs. SetNativeControl

$
0
0

I was just trying to make a UIView (Just a box) I cloud present in forms to find out how this works.

I am creating custom renderer that inherits from ViewRenderer<MyCustomView, UIView>
I am then creating my box

UIView square = new UIView (new RectangleF (100, 100, 100, 100));
square.BackgroundColor = UIColor.Purple;
SetNativeControl (square);

But when I try to add it as a SubView it doesent work?
I can use the "SetNativeControl" directly to my square and it works fine.

So what is the difference between adding the box as a SubView vs SetNativeControl.

Another thing: The reason I try to do this is because I often miss some functionality in Forms, but it have many things I do not want to lose.
So it would be nice to just make some elements (not control but more like a hole or half view/page) in pure Xamarin iOS and use it as a custom renderer. Is there anything wrong with this approach?


Viewing all articles
Browse latest Browse all 75885

Trending Articles