Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SampleManager.Current.Initialize();
            List <SearchableTreeNode> data = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList();

            TableView.Source = new CategoryDataSource(this, data);

            TableView.ReloadData();

            var searchResultsController = new SearchResultsViewController(this, data);

            // Create search updater and wire it up
            var searchUpdater = new SearchResultsUpdater();

            searchUpdater.UpdateSearchResults += searchResultsController.Search;

            // Create a new search controller
            SearchController = new UISearchController(searchResultsController)
            {
                SearchResultsUpdater = searchUpdater
            };

            // Display the search controller
            TableView.TableHeaderView  = SearchController.SearchBar;
            DefinesPresentationContext = true;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationController.NavigationBar.TintColor    = UIColor.White;
            NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(0, 140, 200);


            NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };
            NavigationController.NavigationBar.LargeTitleTextAttributes = NavigationController.NavigationBar.TitleTextAttributes;

            SampleManager.Current.Initialize();
            List <SearchableTreeNode> data = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList();

            TableView.Source = new CategoryDataSource(this, data);

            TableView.ReloadData();

            var searchResultsController = new SearchResultsViewController(this);

            // Create search updater and wire it up
            var searchUpdater = new SearchResultsUpdater();

            searchUpdater.UpdateSearchResults += searchResultsController.Search;

            // Create a new search controller
            SearchController = new UISearchController(searchResultsController)
            {
                SearchResultsUpdater = searchUpdater
            };
            SearchController.SearchBar.TintColor = UIColor.White;



            // Show the search bar in the navigation/header area
            NavigationItem.SearchController = SearchController;
            UITextField entry = SearchController.SearchBar.ValueForKey(new NSString("searchField")) as UITextField;

            if (entry != null)
            {
                var backgroundView = entry.Subviews.FirstOrDefault();
                if (backgroundView != null)
                {
                    backgroundView.BackgroundColor    = UIColor.White;
                    backgroundView.Layer.CornerRadius = 10;
                    backgroundView.ClipsToBounds      = true;
                }

                entry.TintColor = View.TintColor;
            }

            // Show search bar by default
            NavigationItem.HidesSearchBarWhenScrolling = false;

            DefinesPresentationContext = true;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SampleManager.Current.Initialize();
            List <SearchableTreeNode> data = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList();

            TableView.Source = new CategoryDataSource(this, data);

            TableView.ReloadData();

            var searchResultsController = new SearchResultsViewController(this);

            // Create search updater and wire it up
            var searchUpdater = new SearchResultsUpdater();

            searchUpdater.UpdateSearchResults += searchResultsController.Search;

            // Create a new search controller
            SearchController = new UISearchController(searchResultsController)
            {
                SearchResultsUpdater = searchUpdater
            };

            // Show the search bar in the navigation/header area
            NavigationItem.SearchController = SearchController;
            UITextField entry = SearchController.SearchBar.ValueForKey(new NSString("searchField")) as UITextField;

            if (entry != null)
            {
                var backgroundView = entry.Subviews.FirstOrDefault();
                if (backgroundView != null)
                {
                    backgroundView.Layer.CornerRadius = 10;
                    backgroundView.ClipsToBounds      = true;
                }
            }

            // Show search bar by default
            NavigationItem.HidesSearchBarWhenScrolling = false;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIImage.FromBundle("Settings"), UIBarButtonItemStyle.Plain, ViewSettingsPage);

            DefinesPresentationContext = true;

            _ = CheckApiKey();
        }