コード例 #1
0
        private void SetBorder()
        {
            // 새로운 보더를 만들자. (색 설정 가능)
            var view = new UIView(new CGRect(0, 0, TabBar.Frame.Width, 1))
            {
                BackgroundColor = Color.Transparent.ToUIColor(),
            };

            // 새로만든 뷰를 탭바에 추가.
            TabBar.AddSubview(view);
        }
コード例 #2
0
ファイル: MainView.cs プロジェクト: divine514/BisnerXamarin
        public sealed override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Main";

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            // Check roles and create tabs accordingly
            var userRoles = Settings.UserRoles;

            // Create viewcontroller array
            var viewcontrollerList = new List <UIViewController>();

            // FEED
            if (userRoles.Any(r => r == Home.View.ToLower()))
            {
                var feedTab = CreateTabFor("Feed", "feed_normal", "feed_active", typeof(FeedViewModel));
                // Set for badge numbering
                FeedTabBarItem = feedTab.TabBarItem;
                viewcontrollerList.Add(feedTab);
            }

            // ACCESS CONTROL
            if (Settings.AccessControlEnabled)
            {
                var accessControlTab = CreateTabFor("AccessControl", "lock_normal", "lock_active",
                                                    typeof(AccessControlViewModel));
                viewcontrollerList.Add(accessControlTab);
            }

            // DASHBOARD
            var dashboardTab = CreateTabFor("Dashboard", "dashboard_normal", "dashboard_active", typeof(DashboardViewModel));

            viewcontrollerList.Add(dashboardTab);

            // CHAT
            if (userRoles.Any(r => r == ApiModels.Security.Roles.Chat.View.ToLower()))
            {
                var chatTab = CreateTabFor("Chat", "chat_normal", "chat_active", typeof(ChatViewModel));
                // Set for badge numbering
                ChatTabBarItem = chatTab.TabBarItem;
                viewcontrollerList.Add(chatTab);
            }

            if (!Settings.AccessControlEnabled)
            {
                // NOTIFICATIONS
                var notificationsTab = CreateTabFor("Notifications", "notifications_normal", "notifications_active",
                                                    typeof(NotificationsViewModel));
                // Set for badge numbering
                NotificationTabBarItem = notificationsTab.TabBarItem;
                viewcontrollerList.Add(notificationsTab);
            }

            // MORE
            var moreTab = CreateTabFor("More", "more_normal", "more_active", typeof(ManageViewModel));

            viewcontrollerList.Add(moreTab);

            // Set the controllers for the tabs
            ViewControllers = viewcontrollerList.ToArray();
            //CustomizableViewControllers = new UIViewController[] { };
            // Set the first viewcontroller (dashboard) as active
            SelectedViewController = ViewControllers[0];
            //SetupBackButton();

            var frame = new CGRect(0.0, 0.0, View.Bounds.Size.Width, 49);
            var v     = new UIView(frame)
            {
                BackgroundColor = Appearance.Colors.TabBarColor
            };

            TabBar.AddSubview(v);
            TabBar.SendSubviewToBack(v);
        }