问题
I'm using https://www.marcbruins.nl/xamarin-ios-hamburger-menu-mvvmcross/ and it works on Portrait orientation:
But on Landscape orientation I have not fill width:
Menu class:
[MvxPanelPresentation (MvxPanelEnum.Left, MvxPanelHintType.ResetRoot, false)]
public partial class MenuView : MvxViewController<MenuViewModel>
{
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
EdgesForExtendedLayout = UIRectEdge.Right;
MenuTableView.Source = new MenuTableViewSource(ViewModel.MenuItems);
var separator = new UIView(new CGRect(0, 0, this.View.Frame.Size.Width, 0.8));
separator.BackgroundColor = UIColor.FromRGB(210, 210, 210);
MenuTableView.TableHeaderView = separator;
}
}
Table Source:
public class MenuTableViewSource : UITableViewSource
{
List<MenuModel> TableItems;
string CellIdentifier = "MenuTableViewCell";
public MenuTableViewSource (List<MenuModel> menuItems)
{
TableItems = menuItems;
}
public override nint RowsInSection (UITableView tableview, nint section)
{
return TableItems.Count;
}
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
MenuTableViewCell cell = tableView.DequeueReusableCell (CellIdentifier) as MenuTableViewCell;
MenuModel item = TableItems[indexPath.Row];
if (cell == null)
cell = MenuTableViewCell.Create ();
cell.BackgroundColor = UIColor.White;
cell.SeparatorInset = UIEdgeInsets.Zero;
cell.LayoutMargins = UIEdgeInsets.Zero;
cell.MenuItemTextLabel.Text = item.Title;
cell.AccessoryView = new UIImageView(image: new UIImage("chevron-right.png"));
return cell;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
MenuModel item = TableItems[indexPath.Row];
item.Navigate.Execute(null);
Mvx.Resolve<IMvxSideMenu>().Close();
}
public override nfloat GetHeightForRow (UITableView tableView, NSIndexPath indexPath)
{
return 60f;
}
}
Also I tried to increase width of View - not working.
Bug on iPad.
Advice, please how to fix it.
来源:https://stackoverflow.com/questions/46224467/mvvmcross-hamburger-menu-for-ios