当前位置: 首页>>代码示例>>C#>>正文


C# UISearchBar.SizeToFit方法代码示例

本文整理汇总了C#中UISearchBar.SizeToFit方法的典型用法代码示例。如果您正苦于以下问题:C# UISearchBar.SizeToFit方法的具体用法?C# UISearchBar.SizeToFit怎么用?C# UISearchBar.SizeToFit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UISearchBar的用法示例。


在下文中一共展示了UISearchBar.SizeToFit方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewWillAppear

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear (animated);

            TableView.Source = new SearchTableSource(this);
            mSearchBar = TableView.TableHeaderView as UISearchBar;

            mSearchBar.Placeholder = "Enter Search Word";
            mSearchBar.SizeToFit();
            mSearchBar.AutocorrectionType = UITextAutocorrectionType.Yes;
            mSearchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            mSearchBar.SearchButtonClicked += (sender, e) =>
            {
                AddWord(mSearchBar.Text);
            };
            mSearchBar.TextChanged += (sender, e) =>
            {
                mSuggestionModel.NewSuggestion(mSearchBar.Text);
            };

            mSuggestionModel.SuggestionChanged += (sender, e) =>
            {
                this.InvokeOnMainThread(delegate
                {
                    TableView.ReloadData();
                });
            };

            mSearchBar.BecomeFirstResponder ();
        }
开发者ID:vmendi,项目名称:ListenAndRepeat,代码行数:30,代码来源:AddWordController.cs

示例2: LoadView

        public override void LoadView()
        {
            base.LoadView();

            InfosTableView = new UITableView(RectangleF.Empty, UITableViewStyle.Plain)
            {
                Frame = this.ContentFrame(),
                Source = new InfosTableSource(),
                RowHeight = 60
            };
            View.AddSubview(InfosTableView);

            var searchBar = new UISearchBar(RectangleF.Empty)
            {
                ShowsCancelButton = true,
                Placeholder = "Find Currency",
                KeyboardType = UIKeyboardType.ASCIICapable
            };
            searchBar.SizeToFit();
            InfosTableView.TableHeaderView = searchBar;

            SearchController = new UISearchDisplayController(searchBar, this)
            {
                Delegate = new SearchDisplayDelegate(),
                SearchResultsSource = new InfosTableSource()
            };
            SearchController.SearchResultsTableView.RowHeight = 60;
        }
开发者ID:seanho,项目名称:CurrencyApp-MonoTouch,代码行数:28,代码来源:CurrenciesController.cs

示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.Title = "My Phrases";

            //create a table
            var width = View.Bounds.Width;
            var height = View.Bounds.Height;
            table = new UITableView (new CGRect (0, 0, width, height));
            table.AutoresizingMask = UIViewAutoresizing.All;
            table.RowHeight = UITableView.AutomaticDimension;
            table.EstimatedRowHeight = 44f;

            //remove seperator lines if cell are empty;
            var frame = new CGRect (0, 0, 0, 0);
            table.TableFooterView = new UIView (frame);

            //add search bar
            UISearchBar searchBar = new UISearchBar ();
            searchBar.SizeToFit ();
            table.TableHeaderView = searchBar;

            DisplayMyPhrases (myPhraseCategoryId, searchBar);
            Add (table);
            DisplayAddMyPhrases ();
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:26,代码来源:MyPhraseScreen.cs

示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.NavigationItem.Title = "Phrases";
            this.NavigationController.NavigationBar.BarStyle = UIBarStyle.BlackOpaque;
            this.NavigationController.NavigationBar.TintColor = UIColor.White;
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB (0, 176, 202);
            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };

            // add table view
            var width = View.Bounds.Width;
            var height = View.Bounds.Height;

            table = new UITableView (new CGRect (0, 0, width, height));
            table.AutoresizingMask = UIViewAutoresizing.All;
            table.RowHeight = UITableView.AutomaticDimension;

            //remove seperator lines if cell are empty;
            var frame = new CGRect (0, 0, 0, 0);
            table.TableFooterView = new UIView (frame);

            //add search bar
            UISearchBar searchBar = new UISearchBar ();
            searchBar.SizeToFit ();
            table.TableHeaderView = searchBar;

            DisplayCategories (searchBar);
            Add (table);
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:32,代码来源:CategoryScreen.cs

示例5: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MvxStandardTableViewSource(TableView, "TitleText FullName;ImageUrl Picture");
            TableView.Source = source;

            _searchBar = new UISearchBar();
            _searchBar.Placeholder = "Enter Search Text";
            _searchBar.SetShowsCancelButton(true, true);
            _searchBar.SizeToFit();
            _searchBar.AutocorrectionType = UITextAutocorrectionType.No;
            _searchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            _searchBar.CancelButtonClicked += SearchBarCancelButtonClicked;
            _searchBar.SearchButtonClicked += (sender, e) => { PerformSearch(); };

            MvxFluentBindingDescriptionSet<FriendsViewController, FriendsViewModel> set =
                this.CreateBindingSet<FriendsViewController, FriendsViewModel>();
            set.Bind(source).To(x => x.Friends);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.ViewDetailsCommand);

            set.Bind(_searchBar).For(x => x.Text).To(vm => vm.SearchTerm);
            set.Apply();

            TableView.ReloadData();

            TableView.TableHeaderView = _searchBar;
        }
开发者ID:slown1,项目名称:Xamarin.Chat,代码行数:28,代码来源:FriendsViewController.cs

示例6: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.Title = title;

            var frame = new CGRect (0, 0, 0, 0);
            TableView.TableFooterView = new UIView (frame);
            TableView.AutoresizingMask = UIViewAutoresizing.All;
            TableView.RowHeight = UITableView.AutomaticDimension;
            TableView.EstimatedRowHeight = 200f;

            UISearchBar searchBar = new UISearchBar ();
            searchBar.SizeToFit ();
            TableView.TableHeaderView = searchBar;

            UISearchDisplayController searchDisplayController = new UISearchDisplayController(searchBar, this);

            var phraseSource = new PhraseSource (this);
            TableView.Source = phraseSource;

            searchDisplayController.SearchResultsSource = phraseSource;
            searchDisplayController.SearchBar.TextChanged += (sender, e) => {
                string text = e.SearchText.Trim ();
                filteredPhrases = (from phrase in phrases
                    where phrase.sourcePhrase.ToUpper ().Contains (text.ToUpper ())
                   	select phrase).ToList ();
            };
            searchDisplayController.SearchResultsTableView.RowHeight = UITableView.AutomaticDimension;
            searchDisplayController.SearchResultsTableView.EstimatedRowHeight = 200f;

            LoadDataForDisplay ();
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:32,代码来源:PhraseScreen.cs

示例7: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			if (cloudManager != null)
				cloudManager.FetchRecords ("SearchRequest", results => {
					previousSearchRequests = results;
					TableView.ReloadData ();
				});

			NavigationItem.HidesBackButton = true;
			TableView.Source = new TableSource (this);
			TableView.AllowsMultipleSelectionDuringEditing = false;

			searchBar = new UISearchBar {
				Placeholder = "search_hint".LocalizedString ("Search text field placeholder"),
				AutocorrectionType = UITextAutocorrectionType.No,
				AutocapitalizationType = UITextAutocapitalizationType.None,
				ShowsCancelButton = true
			};

			searchBar.SizeToFit ();
			searchBar.SearchButtonClicked += (sender, e) => {
				if (cloudManager != null && 
					!previousSearchRequests.Where (record => (NSString)record ["value"] == searchBar.Text).Any ())
					SaveSearchRequest (searchBar.Text);
				
				Search ();
			};

			searchBar.CancelButtonClicked += (sender, e) => NavigationController.PopViewController (false);

			NavigationItem.TitleView = searchBar;
			searchBar.BecomeFirstResponder ();
		}
开发者ID:RobGibbens,项目名称:Coffee-Filter,代码行数:35,代码来源:SearchViewController.cs

示例8: CreateSearchBar

 static UISearchBar CreateSearchBar ()
 {
     UISearchBar search = new UISearchBar ();
     search.Placeholder = "Search Bing";
     search.SizeToFit ();
     search.AutocorrectionType = UITextAutocorrectionType.No;
     search.AutocapitalizationType = UITextAutocapitalizationType.None;
     return search;
 }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:9,代码来源:BingSearchController.cs

示例9: StringTableViewController

		public StringTableViewController ()
		{
			TableView.Source = source = new TableViewSource (){
				Parent = this,
			};
			searchBar = new UISearchBar ();
			searchBar.TextChanged += (object sender, UISearchBarTextChangedEventArgs e) => {
				filteredItems = items.Where(x=> x.IndexOf(searchBar.Text, StringComparison.CurrentCultureIgnoreCase) >= 0).ToList();
				TableView.ReloadData();
			};
			searchBar.SizeToFit ();
			TableView.TableHeaderView = searchBar;
		}
开发者ID:hasithaPrasanga,项目名称:XamarinStore,代码行数:13,代码来源:StringTableViewController.cs

示例10: CustomerSearchViewController

        public CustomerSearchViewController()
        {
            this.Title = "Customer Search";
            this.EdgesForExtendedLayout = UIRectEdge.None;
            this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add,(s,e)=>{
                this.NavigationController.PushViewController(new CustomerInformationViewController{
                    Customer = new Customer(),
                    Popover = Popover,
                    Created = (c) =>{
                        CustomerPicked (c);
                    }
                },true);
            });
            this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem ("Cash Customer", UIBarButtonItemStyle.Plain ,async (s, e) => {
                var cust = await  Database.Main.GetCashCustomer();
                CustomerPicked(cust);
            });
            PreferredContentSize = new System.Drawing.SizeF (700, 400);
            View.Add (searchBar = new UISearchBar{
                //SearchBarStyle = UISearchBarStyle.Minimal,
                BarStyle = UIBarStyle.Black,
                Translucent = true,
            });
            searchBar.SearchButtonClicked += async (object sender, EventArgs e) => {
                source.State = SearchSource.SearchState.Searching;
                tableView.ReloadData();

                var results = await WebService.Main.SearchCustomer(searchBar.Text);
                if(results == null)
                    source.State = SearchSource.SearchState.Error;
                else{
                    source.Customers = results;
                    source.State = SearchSource.SearchState.Completed;
                }
                tableView.ReloadData();

            };
            var tv = getTextField (searchBar);
            searchBar.Subviews.ForEach (x => {
                Console.WriteLine(x.GetType());
            });
            searchBar.Subviews.OfType<UITextField> ().ForEach (x => {
                x.TextColor = UIColor.White;
            });
            searchBar.SizeToFit ();
            View.Add (tableView = new UITableView{
                Source = (source = new SearchSource()),
                RowHeight = 75,
            });
        }
开发者ID:nagyist,项目名称:iPadPos,代码行数:50,代码来源:CustomerSearchViewController.cs

示例11: ViewDidLoad

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            Title = "Bing Search Demo";
            TableView.Source = new TableSource (this);
            
            searchBar = new UISearchBar ();
            searchBar.Placeholder = "Search Bing";
            searchBar.SizeToFit ();
            searchBar.AutocorrectionType = UITextAutocorrectionType.No;
            searchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            searchBar.SearchButtonClicked += (sender, e) => {
                Search (); };
            
            TableView.TableHeaderView = searchBar;
        }
开发者ID:GSerjo,项目名称:Seminars,代码行数:17,代码来源:SearchResultsController.cs

示例12: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            EdgesForExtendedLayout = UIRectEdge.None;
            _source = new TableSource (ViewModel.Markets, this);
            TableView.Source = _source;

            _searchBar = new UISearchBar ();
            _searchBar.Placeholder = "Enter Zip Code";
            _searchBar.SizeToFit ();
            _searchBar.SearchButtonClicked += async delegate(object sender, EventArgs e) {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
                await ViewModel.SearchMarkets(_searchBar.Text);
                _source.Items = ViewModel.Markets;
                TableView.ReloadData();
                _searchBar.ResignFirstResponder();
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            TableView.TableHeaderView = _searchBar;
        }
开发者ID:james-alt,项目名称:FarmersMarket,代码行数:22,代码来源:MainViewController.cs

示例13: PodcastsController

    public PodcastsController(UICollectionViewLayout layout)
      : base(layout)
    {

      searchBar = new UISearchBar
      {
        Placeholder = "Search for a podcast",
        AutocorrectionType = UITextAutocorrectionType.No,
        AutocapitalizationType = UITextAutocapitalizationType.None,
        AutoresizingMask = UIViewAutoresizing.All,
        Alpha = 0.4f
      };

      searchBar.SizeToFit();

      searchBar.SearchButtonClicked += (sender, e) =>
      {
        Search(searchBar.Text);
        searchBar.ResignFirstResponder();
      };

      searchBar.TextChanged += (sender, e) => Search(e.SearchText);
    }
开发者ID:rampyodm,项目名称:XamarinDNR,代码行数:23,代码来源:PodcastsController.cs

示例14: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            searchBar = new UISearchBar ();
            searchBar.Placeholder = "Enter Name";
            searchBar.SizeToFit ();
            searchBar.AutocorrectionType = UITextAutocorrectionType.No;
            searchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            searchBar.ShowsCancelButton = true;

            searchBar.CancelButtonClicked += (object sender, EventArgs e) => {
                searchBar.ResignFirstResponder();
            };

            searchBar.TextChanged+= (object sender, UISearchBarTextChangedEventArgs e) => {
                List<Household> filtered;

                filtered = households.Where (x => ((x.Spouse1.LastName + ", " + x.Spouse1.FirstName + " & " + (x.Spouse2ID != 0 ? x.Spouse2.LastName + ", " + x.Spouse2.FirstName : "")).ToLower()).Contains (e.SearchText.ToLower())).Select (x => x).ToList();

                tblHouseholds.Source = new HouseholdTableSource(filtered,"", this);
                tblHouseholds.ReloadData();
            };

            RectangleF rect = searchBar.Frame;
            if (UserInterfaceIdiomIsPhone)
                rect.Y = 63f;
            else
                rect.Y = 63f;
            searchBar.Frame = rect;
            View.AddSubview (searchBar);

            btnAddHousehold.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                HouseholdDetailViewController pdvc = parent.Storyboard.InstantiateViewController("HouseholdDetailViewController") as HouseholdDetailViewController;
                pdvc.MarriedRelationshipID = 0;
                parent.PushViewController(pdvc,true);
            };
        }
开发者ID:Wazzo79,项目名称:Illumin8---Kids-Checkin-App,代码行数:39,代码来源:HouseholdsViewController.cs


注:本文中的UISearchBar.SizeToFit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。