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


C# UISearchBar.BecomeFirstResponder方法代码示例

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


在下文中一共展示了UISearchBar.BecomeFirstResponder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            try
            {
                //View = new UniversalView();

                base.ViewDidLoad();
                this.Title = "Derby Events";

                View.Frame = UIScreen.MainScreen.Bounds;
                View.BackgroundColor = UIColor.White;
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                table = new UITableView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height));

                Action<EventsJson> skaters = new Action<EventsJson>(UpdateAdapter);
                Calendar.PullEvents(lastPagePulled, PAGE_COUNT, skaters);
                // Perform any additional setup after loading the view
                loading = new LoadingView();
                loading.ShowActivity("loading events");
                source = new EventsTableView(initialArray.Events, this.NavigationController);
                source.GotCell += source_GotCell;
                table.Source = source;
                table.RowHeight = 80;


                searchBar = new UISearchBar(new RectangleF(0, 0, 200, 44));
                searchBar.SetShowsCancelButton(true, false);
                searchBar.CancelButtonClicked += searchBar_CancelButtonClicked;
                searchBar.SearchButtonClicked += searchBar_SearchButtonClicked;


                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Search, (sender, args) =>
    {
        searchBar.BecomeFirstResponder();
        UIView searchBarView = new UIView(new RectangleF(0, 0, 250, 44));
        searchBarView.AddSubview(searchBar);
        this.NavigationItem.TitleView = searchBarView;
    })
, true);

                this.NavigationItem.BackBarButtonItem = new UIBarButtonItem();
                this.NavigationItem.BackBarButtonItem.Title = "Events";

                View.Add(table);
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
            }

        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:51,代码来源:EventsViewController.cs

示例4: ViewDidLoad

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

            View.Layer.Frame = new CoreGraphics.CGRect (0, 0, uvWidth, uvheight);
            NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, uvWidth, 44));
            utListView = new UITableView (new CoreGraphics.CGRect (0, 44, uvWidth, uvheight));
            //			UIBarButtonItem TrashBtn = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, TrashBtnClicked);

            UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
            btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
            btnCancel.SetTitle ("Cancel", UIControlState.Normal);
            btnCancel.TouchUpInside += (object sender, EventArgs e) => {
                if(popover!=null)
                    popover.Dismiss(false);
            };
            UIBarButtonItem TrashBtn = new UIBarButtonItem (btnCancel);

            UINavigationItem navgitem = new UINavigationItem ("Select");
            navgitem.SetLeftBarButtonItem (TrashBtn, true);
            NavBar.PushNavigationItem(navgitem,true);
            searchBar=new UISearchBar(new CoreGraphics.CGRect (100, 0, uvWidth-100, 44));
            this.View.Add (NavBar);
            this.View.AddSubview(utListView);
            this.View.AddSubview(searchBar);
            this.utListView.Source =new CodePickerSource(this);
            searchBar.BecomeFirstResponder ();
            searchBar.Text = searchkey;
            searchBar.TextChanged+= async (object sender, UISearchBarTextChangedEventArgs e) => {
                if(!string.IsNullOrEmpty(searchBar.Text))
                {
                    AppDelegate.pb.Start(this.View,"Searching...");
                    var webClient = new WebClient();
                    string url =  "http://reference.iprocedures.com/"+type+"/"+searchBar.Text.Trim()+"/20";
                    string procData = webClient.DownloadString (url);
                    procedureItems = (ProcedureDiagnosticMaster)JsonConvert.DeserializeObject (procData, typeof(ProcedureDiagnosticMaster));
                    int uwidth = 0;
                    DataSource = SetProcedureDataSource(out uwidth);
                    this.utListView.Source =new CodePickerSource(this);
                    this.utListView.ReloadData();
                    AppDelegate.pb.Stop();
                }

                    //RectangleF fillrect = new RectangleF(0,0,uwidth,uvheight);
                    //this.View.Frame=fillrect;

            };

            // Perform any additional setup after loading the view, typically from a nib.
        }
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:50,代码来源:CodePicker.cs


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