【发布时间】:2019-01-22 18:11:53
【问题描述】:
我已经开始学习 Xamarin.iOS 并尝试通过 Storyboards 添加搜索栏元素,并以编程方式在 ViewController 中添加。我很难理解为什么当我对搜索栏进行编码而不是按照 Microsoft 文档中所述进行拖放时,我无法在情节提要上看到它?
文档:https://docs.microsoft.com/en-us/xamarin/ios/user-interface/controls/searchbar
searchBar = new UISearchBar(){
Placeholder = "Enter your search Item",
Prompt = "Search Entered here",
ShowsScopeBar = true,
ScopeButtonTitles = new string[]{ "Boston", "London",
"SF" },
};
我需要应用哪些设置才能在 Storyboard 上看到我的硬编码元素?
在项目结构方面,我刚刚启动了 Visual Studio 中提供的默认 Single Page iOS 模板,将代码粘贴到默认创建的 ViewController 类中,然后尝试寻找出现在 Main.storyboard 上的元素。我知道也许我没有设置任何允许情节提要看到“后端”ViewController 代码的设置。
任何帮助将不胜感激!谢谢!
【问题讨论】:
-
你的问题有点混乱。您是否希望看到
Storyboard分解为各种Timelines 以及这些Timelines 的值,就像它是一个树视图一样? -
没有。它根本与时间轴或树视图无关。我有一个默认的
Main.storyboard和一个SearchBar元素,我在我的代码中概述的默认ViewController类中编码。我无法看到SearchBar以图形方式出现在Main.storyboard上,但是当我启动Iphone 模拟时它看起来很好。
标签: c# xamarin xamarin.ios