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

Specified Cast not Valid while loading a Xib to a View

$
0
0

I'm trying to load a Xib to a View inside the ViewController but it is throwing the below error.

System.InvalidCastException: Specified cast is not valid against this line var v = Runtime.GetNSObject(arr.ValueAt(0));

In the ViewDidLoad() method I am calling this code:

void ViewDidLoad(){

var navigationDrawer=NavigationDrawer.Create(this);

}
and in the Xib View, it is the Code.

partial Class NavigationDrawer: UIView
{
public static UIView Create(UIViewController currentViewController){
var arr = NSBundle.MainBundle.LoadNib("NavigationDrawer", null, null);
var v = Runtime.GetNSObject(arr.ValueAt(0));======>Getting Exception Here
}
}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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