I have created a contentview and in my pcl and in the IOS renderer I have created the below scrollview and textview, but I don't see anything in the page
[assembly: ExportRenderer(typeof(SthotramView), typeof(SthotramViewRenderer))]
namespace Sthotraani.iOS.CustomControls
{
public class SthotramViewRenderer:ViewRenderer
{
UITextView utv;
UIScrollView usv;
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)
{
base.OnElementChanged(e);
if (e.NewElement == null)
retu;
if (e.OldElement == null)
{
var sthotramView = Element as SthotramView;
if (sthotramView.IsNotNull())
{
utv = new UITextView();
utv.Selectable = false;
utv.Editable = false;
utv.Font = UIFont.FromName(sthotramView.FontFamily,(nfloat)sthotramView.FontSize);
utv.MultipleTouchEnabled = true;
utv.Text = sthotramView.Text;
usv = new UIScrollView(sthotramView.Bounds.ToRectangleF());
usv.MinimumZoomScale = sthotramView.MinimumZoomScale;
usv.MaximumZoomScale = sthotramView.MaximumZoomScale;
usv.AddSubview(utv);
usv.ViewForZoomingInScrollView = (UIScrollView sv) => { retu utv; };
SetNativeControl(usv);
}
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var sthotramView = Element as SthotramView;
if (sthotramView.IsNotNull())
{
if (e.PropertyName == "FontSize" || e.PropertyName == "FontFamily")
utv.Font = UIFont.FromName(sthotramView.FontFamily, (nfloat)sthotramView.FontSize);
if (e.PropertyName == "Text")
{
utv.Text = sthotramView.Text;
usv.SizeToFit();
}
}
}
}
I am not sure, what I am doing wrong. Please help me. I need to display large text with zoom capabilities that's why I choose this way. Earlier I used to have a xamarin label which always crashes due to memory issue with large text.
