2

I'm using https://www.marcbruins.nl/xamarin-ios-hamburger-menu-mvvmcross/ and it works on Portrait orientation:

Portrait orientation menu

But on Landscape orientation I have not fill width:

Landscape orientation menu

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;
        }
    }

My constrains

Also I tried to increase width of View - not working.

Bug on iPad.

Advice, please how to fix it.

DaleYY
  • 130
  • 1
  • 9
  • 1
    @AshleyMills Thank you. I've added code. – DaleYY Sep 14 '17 at 17:11
  • I test the demo in that link, it works well. How you set the constraint of tableview, is it right aligned with super view? – ColeX Sep 15 '17 at 07:01
  • @ColeXia Sorry, I forgot to wright - bug on iPad. [link](http://clip2net.com/clip/m0/02324-clip-73kb.jpg?nocache=1) Updated question. Thanks. – DaleYY Sep 15 '17 at 14:41
  • It opens on 80% of View. And I cannot to modify it. So, in the Portrait mode works ok, but in Landscape - bad. – DaleYY Sep 25 '17 at 10:41

0 Answers0