Example #1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            var storyMenuItemImage        = UIImage.FromFile("Images/bg_menuitem_normal.png");
            var storyMenuItemImagePressed = UIImage.FromFile("Images/bg_menuitem_highlighted.png");

            int itemCount = ITEM_DRAWABLES.Length;

            ApexMenu.MenuItem[] menus = new ApexMenu.MenuItem[itemCount];
            for (int i = 0; i < itemCount; i++)
            {
                var item = UIImage.FromFile(ITEM_DRAWABLES[i]);

                menus[i] = new ApexMenu.MenuItem(storyMenuItemImage, storyMenuItemImagePressed, item);
            }

            ApexMenu.Menu menu = new ApexMenu.Menu(this.window.Bounds, menus);

            menu.MenuItemSelected += (sender, e) => Console.WriteLine(e.Selected);

            menu.BackgroundColor = UIColor.Black;
            this.window.AddSubview(menu);

            // make the window visible
            window.MakeKeyAndVisible();

            return(true);
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            ApexMenu.Menu apexMenu = (ApexMenu.Menu)FindViewById(Resource.Id.apex_menu);

            int itemCount = ITEM_DRAWABLES.Length;

            for (int i = 0; i < itemCount; i++)
            {
                ImageView item = new ImageView(this);
                item.SetImageResource(ITEM_DRAWABLES[i]);

                int           position = i;
                Action <View> listener = (View v) => {
                    Toast.MakeText(this, "position:" + position, ToastLength.Short).Show();
                };
                apexMenu.AddItem(ITEM_DRAWABLES[i], listener);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            //Button button = FindViewById<Button> (Resource.Id.myButton);
            //
            //button.Click += delegate {
            //	button.Text = string.Format ("{0} clicks!", count++);
            //};
        }