The Same Code,The Different Behavior!(Very Weird)

aozhiminaozhimin USMember
edited July 2014 in Xamarin.iOS

I meet a very strange problem that I can't solve it by myself.I think someone must have this problem too,problem as follows:If I new a project and create
a Cocoa View with Controller,For example ,I named it TestView,then TestViewController will automatically have a property View,and In this method,it is as
follows:return (TestView)base.View; and this is right .because I debug it ,the base.view is definely a TestView type.

However,When I new another project ,it means there are two project in a solution , one is exe ,and the other is library ,and I also repeat the steps as I do
it before ,I new a Cocoa View with Controller,and I named it TestView,and it will have a property too ,everything just like before,but when i run this project , it
throw a exception ,say System.invalidCastException.And I debug it,Finally,I find what's wrong with it. The base.View not retrun a TestView but a NsView ,what
strange it is ?The Same Code ,But The Different Behavior! I hope Someone can tell me if you have the answer to my Problem . Thank you very much!

Sign In or Register to comment.