Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

iOS RendererFactory doesn't seem to render component correctly

$
0
0

Hi There,

We're facing an issue while trying write a custom layout kind of renderer for our application. The Android implementation works flawlessly. But on iOS side we're facing issues while we're trying to render child components using RendererFactory and Renderers.

The code we're using to render the child items is something like this:

// Xamarin forms view creation
View view = new Label
{
        Text = "Test label",
};
.
.
.
IVisualElementRenderer renderer = RendererFactory.GetRenderer(view);
UIView nativeView = renderer.NativeView;
container.AddSubview(nativeView);
.
.
.
nativeView .Frame = new CGRect(0, i * 40, 100, 40);

This doesn't seem to work regardless of what component we're trying to render.

If we simply change the first two statements to build a custom UILabel instead of a xamarin forms rendered view... it works flawlessly,

.
.
.
UILabel nativeView = new UILabel();
nativeView.Text = "Test label";
container.AddSubview(nativeView);
.
.
.
nativeView .Frame = new CGRect(0, i * 40, 100, 40);

Are we missing something here?

Any help would be appreciated.

Thanks.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>