我在ios(Xamarin)中创建SlideNavigation Drawer。 我在下面链接的帮助下创建了
https://github.com/thedillonb/MonoTouch.SlideoutNavigation
代码工作正常,我想要。
代码:
class DummyControllerLeft : DialogViewController { float labelHeight; UIImageView profileImage; public DummyControllerLeft() : base(UITableViewStyle.Plain, new RootElement("")) { this.labelHeight = labelHeight; Root.Add(new Section() { new StyledStringElement("Home", () => NavigationController.PushViewController(new HomeViewController(), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear, Font = UIFont.FromName("Helvetica-Bold", 16f) }, }); TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; TableView.BackgroundColor = UIColor.Clear.FromHexString("#0072BA", 1.0f); } }但是你可以看到我只能在我的代码中添加String名称,它是“Home”。 现在我想添加Image 。
我在google和SO中搜索了很多东西。 但没有什么是我的工作。
任何帮助将不胜感激。
I am creating SlideNavigation Drawer in ios(Xamarin). and I have created with help of below link
https://github.com/thedillonb/MonoTouch.SlideoutNavigation
The code is working fine as I want.
Code :
class DummyControllerLeft : DialogViewController { float labelHeight; UIImageView profileImage; public DummyControllerLeft() : base(UITableViewStyle.Plain, new RootElement("")) { this.labelHeight = labelHeight; Root.Add(new Section() { new StyledStringElement("Home", () => NavigationController.PushViewController(new HomeViewController(), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear, Font = UIFont.FromName("Helvetica-Bold", 16f) }, }); TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; TableView.BackgroundColor = UIColor.Clear.FromHexString("#0072BA", 1.0f); } }But As you can see I have only able to add String name in my code case it is "Home". Now I want to add Image.
I search lot's of thing in google and SO. But nothing is work me.
Any Help will be Appreciated.
最满意答案
您可以设置StyledStringElement Image属性,这将解决您的问题。
StyledStringElement home = new StyledStringElement ("Home", () => NavigationController.PushViewController (new HomeViewController (), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear }; home.Image = new UIImage ("noimage.png"); Root.Add (new Section () { home });You can set Image property of StyledStringElement That will solve your problem.
StyledStringElement home = new StyledStringElement ("Home", () => NavigationController.PushViewController (new HomeViewController (), true)) { TextColor = UIColor.White, BackgroundColor = UIColor.Clear }; home.Image = new UIImage ("noimage.png"); Root.Add (new Section () { home });更多推荐
发布评论