public override void LayoutSubviews() { //NavigationDrawer initialize sideMenuController = new SFNavigationDrawer(); mainView = new MainPageView(this.Frame); UIButton menubutton = new UIButton(); menubutton.Frame = new CGRect(10, 10, 30, 30); menubutton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal); mainView.AddSubview(menubutton); sideMenuController.ContentView = mainView; if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { sideMenuController.DrawerWidth = (this.Bounds.Width * 40) / 100; } else { sideMenuController.DrawerWidth = (this.Bounds.Width * 60) / 100; } sideMenuController.DrawerHeight = this.Bounds.Height; mainView.Frame = new CGRect(0, 0, this.Bounds.Width, this.Bounds.Height); //Menu Page Design table = new UITableView(new CGRect(0, 0, sideMenuController.DrawerWidth, this.Frame.Height)); // defaults to Plain style tableItems = new string[] { "Home", "Profile", "Inbox", "Outbox", "Sent Items", "Trash" }; TableSource tablesource = new TableSource(tableItems); tablesource.customise = false; table.Source = tablesource; this.BackgroundColor = UIColor.FromRGB(63, 134, 246); HeaderView = new UIView(); HeaderView.Frame = new CGRect(0, 0, sideMenuController.DrawerWidth, 100); HeaderView.BackgroundColor = UIColor.FromRGB(49, 173, 225); UIView centerview = new UIView(); centerview.Frame = new CGRect(0, 100, sideMenuController.DrawerWidth, 500); centerview.Add(table); usernameLabel = new UILabel(); usernameLabel.Frame = new CGRect(0, 70, sideMenuController.DrawerWidth, 30); usernameLabel.Text = "James Pollock"; usernameLabel.TextColor = UIColor.White; usernameLabel.TextAlignment = UITextAlignment.Center; HeaderView.AddSubview(usernameLabel); userImg = new UIImageView(); userImg.Frame = new CGRect((sideMenuController.DrawerWidth / 2) - 25, 15, 50, 50); userImg.Image = new UIImage("Images/User.png"); HeaderView.AddSubview(userImg); sideMenuController.DrawerHeaderView = HeaderView; sideMenuController.DrawerContentView = centerview; sideMenuController.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft; this.AddSubview(sideMenuController); menubutton.TouchDown += (object sender, System.EventArgs e) => { sideMenuController.ToggleDrawer(); }; foreach (var view in this.Subviews) { sideMenuController.Frame = new CGRect(0, 0, this.Frame.Width, this.Frame.Height); positionLabel.Frame = new CGRect(this.Frame.X + 10, 0, PopoverSize.Width - 20, 30); positionbutton.Frame = new CGRect(this.Frame.X + 10, 40, PopoverSize.Width - 20, 30); transitionLabel.Frame = new CGRect(this.Frame.X + 10, 90, PopoverSize.Width - 20, 30); transitionbutton.Frame = new CGRect(this.Frame.X + 10, 130, PopoverSize.Width - 20, 30); selectionPicker1.Frame = new CGRect(0, PopoverSize.Height / 2, PopoverSize.Width, PopoverSize.Height / 3); selectionPicker2.Frame = new CGRect(0, PopoverSize.Height / 2, PopoverSize.Width, PopoverSize.Height / 3); doneButton.Frame = new CGRect(0, PopoverSize.Height / 2.5, PopoverSize.Width, 40); } this.optionView(); }
public override void LayoutSubviews () { //NavigationDrawer initialize sideMenuController = new SFNavigationDrawer (); mainView = new MainPageView(this.Frame); UIButton bn=new UIButton(); bn.Frame =new CGRect (10, 10, 30, 30); bn.SetBackgroundImage (new UIImage ("Images/menu.png"), UIControlState.Normal); mainView.AddSubview (bn); sideMenuController.ContentView = mainView; if((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { sideMenuController.DrawerWidth = (this.Bounds.Width*40)/100; } else sideMenuController.DrawerWidth = (this.Bounds.Width*60)/100; sideMenuController.DrawerHeight = this.Bounds.Height; mainView.Frame = new CGRect (0, 0, this.Bounds.Width, this.Bounds.Height); //Menu Page Design table = new UITableView(new CGRect(0, 0, sideMenuController.DrawerWidth, this.Frame.Height)); // defaults to Plain style tableItems = new string[] {"Home","Profile","Inbox","Outbox","Sent Items","Trash"}; TableSource sc = new TableSource(tableItems); sc.customise = false; table.Source = sc; this.BackgroundColor = UIColor.FromRGB(63,134,246); HeaderView = new UIView (); HeaderView.Frame = new CGRect (0, 0, sideMenuController.DrawerWidth, 100); HeaderView.BackgroundColor = UIColor.FromRGB (49, 173, 225); UIView centerview = new UIView (); centerview.Frame = new CGRect (0, 100, sideMenuController.DrawerWidth, 500); centerview.Add (table); lbe = new UILabel (); lbe.Frame =new CGRect (0, 70, sideMenuController.DrawerWidth, 30); lbe.Text="James Pollock"; lbe.TextColor = UIColor.White; lbe.TextAlignment = UITextAlignment.Center; HeaderView.AddSubview (lbe); imageview=new UIImageView(); imageview.Frame =new CGRect ((sideMenuController.DrawerWidth/2)-25, 15, 50, 50); imageview.Image = new UIImage ("Images/User.png"); HeaderView.AddSubview (imageview); sideMenuController.DrawerHeaderView = HeaderView; sideMenuController.DrawerContentView = centerview; sideMenuController.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft; this.AddSubview (sideMenuController.View); bn.TouchDown+= (object sender, System.EventArgs e) => { sideMenuController.ToggleDrawer(); }; foreach (var view in this.Subviews) { label3.Frame = new CGRect (this.Frame.X +10, this.Frame.Y-20, this.Frame.Size.Width - 20, 30); textbutton.Frame=new CGRect(this.Frame.X +10, this.Frame.Y+20, this.Frame.Size.Width - 20, 30); label4.Frame = new CGRect (this.Frame.X +10, this.Frame.Y+60, this.Frame.Size.Width - 20, 30); textbutton1.Frame=new CGRect(this.Frame.X +10, this.Frame.Y+100, this.Frame.Size.Width - 20, 30); picker1.Frame = new CGRect (0, this.Frame.Size.Height-(this.Frame.Size.Height/3), this.Frame.Size.Width, this.Frame.Size.Height/3); picker2.Frame = new CGRect (0, this.Frame.Size.Height-(this.Frame.Size.Height/3), this.Frame.Size.Width , this.Frame.Size.Height/3); doneButton.Frame = new CGRect (0, this.Frame.Size.Height-(this.Frame.Size.Height/3), this.Frame.Size.Width, 30); } }