/// <summary>
/// Gets the tab bar controller string.
/// </summary>
/// <returns>The tab bar controller string.</returns>
public static string[,] GetTabBarControllerStr()
{
string[,] nemulist;
Dictionary<string,string> dic = XmlHelper.Instance.GetXmlNodeList ("iosconfig.xml", "login/tabbarcontroller/items");
if (dic != null) {
int _row = dic.Count;
nemulist = new string[_row, 3];
int i = 0;
foreach (KeyValuePair<string,string> kv in dic) {
nemulist [i, 0] = kv.Key;
nemulist [i, 1] = chongqing.ControlCenter.ImagePath + kv.Value.Split ('|') [0];
nemulist [i, 2] = chongqing.ControlCenter.ImagePath + kv.Value.Split ('|') [1];
i++;
}
return nemulist;
} else {
return null;
}
}
public void ttt(string _content)
{
string[,] nemulist = Tools.GetTabBarControllerStr ();
string _name = this.UserName.Text;
tabBarController.ViewControllers = new UIViewController [] {
new zerothViewController(_content, _name, nemulist[0,0],"0"),
new FirstViewController(_name, nemulist[1,0], "1"),
new SecondViewController(nemulist[2,0], "2"),
new ThirdViewController(_name, nemulist[3,0], "3"),
new FourthViewController(_name, nemulist[4,0], "4")
};
tabBarController.TabBar.Items.ToList ().ForEach (i => i.SetFinishedImages (UIImage.FromFile (nemulist [i.Tag, 1]), UIImage.FromFile (nemulist [i.Tag, 2])));
tabBarController.ViewControllerSelected += delegate(object sender1, UITabBarSelectionEventArgs e) {
int _tag = e.ViewController.TabBarItem.Tag;
string _title = e.ViewController.TabBarItem.Title;
this.Title = _title;
if (_tag == 0) {
this.NavigationController.SetNavigationBarHidden (true, false);
}
if (_tag > 0) {
this.NavigationController.SetNavigationBarHidden (false, false);
this.NavigationController.NavigationBar.SetBackgroundImage (UIImage.FromFile ("alltopbg1.png"), UIBarMetrics.Default);
}
if (e.ViewController.TabBarItem.Title == "课程") {
((FirstViewController)tabBarController.ViewControllers [_tag]).BindData ();
} else if (e.ViewController.TabBarItem.Title == "资讯") {
((SecondViewController)tabBarController.ViewControllers [_tag]).BindData ();
} else if (e.ViewController.TabBarItem.Title == "我的课程") {
this.NavigationItem.SetRightBarButtonItem (
new UIBarButtonItem (UIBarButtonSystemItem.Edit, (sender2,args) => {
if (this.NavigationItem.RightBarButtonItem.Title == null) {
this.NavigationItem.RightBarButtonItem.Title = "Edit";
}
if (this.NavigationItem.RightBarButtonItem.Title == "Edit") {
((BaseViewController)tabBarController.ViewControllers [_tag]).SetEditing (true, true);
this.NavigationItem.RightBarButtonItem.Title = "Done";
} else {
((BaseViewController)tabBarController.ViewControllers [_tag]).SetEditing (false, true);
this.NavigationItem.RightBarButtonItem.Title = "Edit";
}
})
, true);
((ThirdViewController)tabBarController.ViewControllers [_tag]).BindData ();
} else if (e.ViewController.TabBarItem.Title == "更多") {
((FourthViewController)tabBarController.ViewControllers [_tag]).ViewDidLoad ();
}
};
this.NavigationController.PushViewController (tabBarController, true);
}

1万+

被折叠的 条评论
为什么被折叠?



