private void BuildInterface() { HomeLayout = new HomeLayoutView(View.Frame); _navigationDrawer = new SFNavigationDrawer { DrawerHeight = View.Bounds.Height, DrawerWidth = (View.Bounds.Width * 80) / 100 }; HomeLayout.MenuButtonTouched = (sender, args) => { _navigationDrawer.ToggleDrawer(); }; _navigationDrawer.DrawerContentView = new MenuView(View, _navigationDrawer.DrawerWidth, _navigationDrawer.DrawerHeight); _navigationDrawer.ContentView = HomeLayout; _navigationDrawer.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft; _navigationDrawer.Transition = SFNavigationDrawerTransition.SFNavigationDrawerTransitionSlideOnTop; if (!UIApplication.SharedApplication.IsRegisteredForRemoteNotifications) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings); UIApplication.SharedApplication.RegisterForRemoteNotifications(); } else { var notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound | UIRemoteNotificationType.NewsstandContentAvailability; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } } View.AddSubviews(_navigationDrawer.View); }
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); } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. //Register Syncfusion license Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MTcwMjM0QDMxMzcyZTMzMmUzME5tUkxGQldvU2Voek1QQUJST2hzUmttb2pzZ1RJeHRVak1TTlRTajVGZnc9"); // Perform any additional setup after loading the view, typically from a nib. SFNavigationDrawer navigation = new SFNavigationDrawer(); this.Add(navigation); navigation.Frame = new CGRect(0, 40, this.View.Frame.Width, this.View.Frame.Height); navigation.DrawerHeaderHeight = 200; navigation.DrawerWidth = 200; // Acts like a android toolbar var toolbar = new UIView() { Frame = new CGRect(0, 0, View.Bounds.Width, 80), BackgroundColor = UIColor.FromRGB(139, 166, 244) }; var addBoardBtn = new UIButton() { Frame = new CGRect(View.Bounds.Width - 130, 40, 150, 40) }; addBoardBtn.SetTitle("Add Board", UIControlState.Normal); addBoardBtn.SetTitleColor(UIColor.White, UIControlState.Normal); addBoardBtn.TouchUpInside += delegate { View.AddSubview(Dialog.MakeDialog(nameof(Board), this, Dialog.CreateSolitiareType.CreateBoard)); }; toolbar.AddSubview(addBoardBtn); // Home menu for toggling the navigation UIButton menubutton = new UIButton(); menubutton.Frame = new CGRect(10, 45, 25, 25); menubutton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal); // When the home button is pressed we will toggle the navigation menubutton.TouchUpInside += (object sender, EventArgs e) => { navigation.ToggleDrawer(); }; toolbar.AddSubview(menubutton); // TODO: Make another UIVIEW that will act like the framelayout for the "fragments" // Main view that acts as the FrameLayout for fragments UIView frameLayout = new UIView(new CGRect(0, toolbar.Bounds.Height, this.View.Frame.Width, this.View.Frame.Height)); frameLayout.BackgroundColor = UIColor.White; // Creating the listview // UITableView is not populating the screen with data UITableView boardTableView = new UITableView(frameLayout.Bounds); boardTableView.Source = new BoardDataSource(this); frameLayout.AddSubview(boardTableView); // Attaching the home button to the navigation // frameLayout.AddSubview(toolbar); // Attaching the contentview to the navigation ContentView (toolbar) UIView MainUIContainer = new UIView(new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height)); MainUIContainer.AddSubviews(toolbar, frameLayout); navigation.ContentView = MainUIContainer; // Acts Acts like the frameLayout for the headerView UIView headerView = new UIView(new CGRect(0, 0, navigation.DrawerWidth, 0)); // Acts like a container for the user's image and name UIView HeaderView = new UIView() { Frame = new CGRect(0, 70, navigation.DrawerWidth, 0), BackgroundColor = UIColor.White }; // Shows the name to the user UILabel usernameLabel = new UILabel() { Frame = new CGRect(10, 80, navigation.DrawerWidth, 30), Text = (NSString)"Name", TextColor = UIColor.DarkTextColor, TextAlignment = UITextAlignment.Left }; // Shows the name to the user UILabel userEmail = new UILabel() { Frame = new CGRect(10, 100, navigation.DrawerWidth, 30), Text = (NSString)"Email", TextColor = UIColor.Gray, TextAlignment = UITextAlignment.Left }; // Adding the user's image and name label to the HeaderView Container UIVIEW HeaderView.AddSubview(new UIImageView(UIImage.FromBundle("Images/default_avatar.png")) { Frame = new CGRect((navigation.DrawerWidth / 2) - 25, 15, 50, 50) }); HeaderView.AddSubview(usernameLabel); HeaderView.AddSubview(userEmail); // Adding the main header container to the headerView headerView.AddSubview(HeaderView); // Acts like the FrameLayout for the contents of the drawer layout UIView drawerContentView = new UIView(new CGRect(0, 0, navigation.DrawerWidth, 0)); // Is the container for the contents of the drawer layout UIView contentContainer = new UIView(new CGRect(0, 0, navigation.DrawerWidth, View.Bounds.Height)); contentContainer.BackgroundColor = UIColor.FromRGB(139, 166, 244); InitDrawerContents(contentContainer, navigation); drawerContentView.AddSubview(contentContainer); navigation.DrawerContentView = drawerContentView; navigation.DrawerHeaderView = headerView; this.Add(navigation); }
public override void ViewDidLoad() { base.ViewDidLoad(); UIView subView = this.View.Subviews[0].Subviews[0]; subView.RemoveFromSuperview(); navigation = new SFNavigationDrawer(); navigation.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height); navigation.DrawerHeaderHeight = 0; navigation.DrawerWidth = 100; UIView contentView = new UIView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height)); contentView.BackgroundColor = UIColor.Purple; subView.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height); UIView headerView = new UIView(new CGRect(0, 0, 0, 0)); UIView HeaderView = new UIView(); HeaderView.Frame = new CGRect(0, 0, navigation.DrawerWidth, 100); HeaderView.BackgroundColor = UIColor.FromRGB(49, 173, 225); UILabel usernameLabel = new UILabel(); usernameLabel.Frame = new CGRect(0, 70, navigation.DrawerWidth, 30); usernameLabel.Text = (NSString)"James Pollock"; usernameLabel.TextColor = UIColor.White; usernameLabel.TextAlignment = UITextAlignment.Center; HeaderView.AddSubview(usernameLabel); UIImageView userImg = new UIImageView(); userImg.Frame = new CGRect((navigation.DrawerWidth / 2) - 25, 15, 50, 50); //userImg.Image = new UIImage("Images/User.png"); HeaderView.AddSubview(userImg); //headerView.AddSubview(HeaderView); UIView drawerContentView = new UIView(new CGRect(0, 0, navigation.DrawerWidth, 100)); UIView centerview = new UIView(); centerview.Frame = new CGRect(0, 0, navigation.DrawerWidth, 600); centerview.BackgroundColor = UIColor.Orange; UIButton homeButton11 = new UIButton(new CGRect(0, 0, navigation.DrawerWidth, 25)); homeButton11.SetTitle("Home", UIControlState.Normal); homeButton11.SetTitleColor(UIColor.Black, UIControlState.Normal); homeButton11.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; homeButton11.Layer.CornerRadius = 0; homeButton11.Layer.BorderWidth = 1; homeButton11.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor; centerview.AddSubview(homeButton11); homeButton11.TouchUpInside += delegate { Console.WriteLine("Home"); navigation.ToggleDrawer(); }; UIButton profileButton = new UIButton(new CGRect(0, 25, navigation.DrawerWidth, 25)); profileButton.SetTitle("Profile", UIControlState.Normal); profileButton.SetTitleColor(UIColor.Black, UIControlState.Normal); profileButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; profileButton.Layer.CornerRadius = 0; profileButton.Layer.BorderWidth = 1; profileButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor; centerview.AddSubview(profileButton); UIButton inboxButton = new UIButton(new CGRect(0, 100, navigation.DrawerWidth, 50)); inboxButton.SetTitle("Inbox", UIControlState.Normal); inboxButton.SetTitleColor(UIColor.Black, UIControlState.Normal); inboxButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; inboxButton.Layer.CornerRadius = 0; inboxButton.Layer.BorderWidth = 1; inboxButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor; //centerview.AddSubview(inboxButton); UIButton outboxButton = new UIButton(new CGRect(0, 150, navigation.DrawerWidth, 50)); outboxButton.SetTitle("Outbox", UIControlState.Normal); outboxButton.SetTitleColor(UIColor.Black, UIControlState.Normal); outboxButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; outboxButton.Layer.CornerRadius = 0; outboxButton.Layer.BorderWidth = 1; outboxButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor; //centerview.AddSubview(outboxButton); UIButton sentItemsButton = new UIButton(new CGRect(0, 200, navigation.DrawerWidth, 50)); sentItemsButton.SetTitle("SentItems", UIControlState.Normal); sentItemsButton.SetTitleColor(UIColor.Black, UIControlState.Normal); sentItemsButton.Layer.CornerRadius = 0; sentItemsButton.Layer.BorderWidth = 1; sentItemsButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor; //centerview.AddSubview(sentItemsButton); UIButton trashButton = new UIButton(new CGRect(0, 250, navigation.DrawerWidth, 50)); trashButton.SetTitle("Trash", UIControlState.Normal); trashButton.SetTitleColor(UIColor.Black, UIControlState.Normal); trashButton.Layer.CornerRadius = 0; trashButton.Layer.BorderWidth = 1; trashButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor; //centerview.AddSubview(trashButton); drawerContentView.AddSubview(centerview); navigation.DrawerContentView = drawerContentView; navigation.DrawerHeaderView = headerView; contentView.AddSubview(subView); navigation.ContentView = contentView; this.Add(navigation); //Perform any additional setup after loading the view, typically from a nib. clickMe.TouchUpInside += delegate { Console.WriteLine("hh"); navigation.ToggleDrawer(); }; }
public void HideDrawer(bool flag) { overlay.Hidden = flag; navigationDrawer.ToggleDrawer(); }