c# - UI Components not instantiating on Xamarin.IoS on Visual Studio for Mac Community when added from designer
问题描述
As the title says, I'm trying to add a new component in my storyboard and it works fine, but after giving it a name and heading to my controller class code behind to work with it, it always comes back as null on runtime.
I am using visual studio for mac community version 8.2.6(build 26).
Steps followed:
- Add new storyboard
- Add a table view controller and assign the controller class on widget properties
- Add a picker to the table view controller and assign it a name
- Call added picker and assign a the corresponding Model overriding ViewDidLoad()
- Run the project
Once the program reaches step #4 and tries to assign the Model. The picker always comes as null. The same happens if I add a label or any other element, once it reaches ViewDidLoad() or any other of the life cycle methods it remains null.
I've tried cleaning, rebuilding, restaring vs, restaring the mac but none of those worked
解决方案
解决了。
从使用“storyboard.InstantiateInitialViewController()”到“storyboard.InstantiateViewController(controllerId)”,由于某种原因,它正确初始化了所有组件。
推荐阅读
- laravel - Laravel Mix 排除特定目录
- javascript - 通过在 Angular 中 2 秒后循环遍历数组来删除动态创建的元素
- html - 单击按钮时添加另一个输入字段
- android - Firebase crashlytics 数据即使在一天的 crashlytics 集成到 android 应用程序后也没有显示在 dashbord 中
- c++ - LZMA c++ 压缩大文件的问题
- javascript - 如何在 Aspnet Core 的 Html.TextBox 中添加掩码
- ios - UICollectionView - 重新打开应用程序时未正确重绘
- angular - 如何防止jsp未经授权访问
- html - Netlify 错误:构建脚本返回非零退出代码:254
- python - Groupby 跟随系列