【发布时间】:2017-05-04 11:39:20
【问题描述】:
如何在 UIViewController 中为每个选项卡添加 Web 视图?
public class TabController: UITabBarController
{
UIViewController tab1, tab2, tab3, tab4, tab5, tab6, tab7;
public TabController()
{
tab1 = new UIViewController();
tab1.Title = "Test";
tab1.View.BackgroundColor = UIColor.Orange;
tab2 = new UIViewController();
tab2.Title = "Test2";
tab2.View.BackgroundColor = UIColor.Orange;
tab3 = new UIViewController();
tab3.Title = "Test3";
tab3.View.BackgroundColor = UIColor.Red;
tab4 = new UIViewController();
tab4.Title = "Test4";
tab4.View.BackgroundColor = UIColor.Red;
tab5 = new UIViewController();
tab5.Title = "Test5";
tab5.View.BackgroundColor = UIColor.Red;
tab6 = new UIViewController();
tab6.Title = "Test6";
tab6.View.BackgroundColor = UIColor.Red;
tab7 = new UIViewController();
tab7.Title = "Test7";
tab7.View.BackgroundColor = UIColor.Red;
var UIViewController = new UIViewController[] {
tab1, tab2, tab3, tab4, tab5, tab6, tab7
};
tab1.TabBarItem = new UITabBarItem(UITabBarSystemItem.Favorites, 0);
ViewControllers = UIViewController;
}
}
所以对于每个选项卡,而不是“tab1.View.BackgroundColor = UIColor.Orange;”,它 应该: Webview + Title + Link 让每个tab有不同的页面?
【问题讨论】:
-
你想做什么?
-
对于每个标签,它必须有一个 web 视图,每个 web 视图都有一个链接和标题,这样当我点击一个标签时,我们称之为 Test1(title),它会打开一个 web使用某个链接查看,然后对其余选项卡进行相同的查看。
-
然后在storyboard中拖动viewcontroller -> 拖动webview并在appdelegate中使用这个viewcontroller。
-
基本上我想做这个家伙所做的事情:stackoverflow.com/questions/16158531/… 我将每个选项卡与不同的子 UIViewController 相关联,但是如何通过链接为每个选项卡添加 UIWebView?跨度>
标签: ios xamarin webview uiviewcontroller