本文整理汇总了C#中UISearchBar.SetShowsCancelButton方法的典型用法代码示例。如果您正苦于以下问题:C# UISearchBar.SetShowsCancelButton方法的具体用法?C# UISearchBar.SetShowsCancelButton怎么用?C# UISearchBar.SetShowsCancelButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISearchBar
的用法示例。
在下文中一共展示了UISearchBar.SetShowsCancelButton方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: SearchButtonClicked
public virtual void SearchButtonClicked (UISearchBar searchBar)
{
// Tells the postManager to reset the tag string with the new tag string
postManager.ResetWithTagString (searchBar.Text);
searchBar.SetShowsCancelButton (false, true);
searchBar.ResignFirstResponder ();
}
示例4: OnEditingStarted
public void OnEditingStarted (UISearchBar searchBar)
{
searchBar.SetShowsCancelButton (true, true);
}
示例5: CancelButtonClicked
public override void CancelButtonClicked (UISearchBar searchBar)
{
searchBar.Text = "";
searchBar.SetShowsCancelButton (false, true);
container.FinishSearch ();
searchBar.ResignFirstResponder ();
}
示例6: OnEditingStopped
public override void OnEditingStopped (UISearchBar searchBar)
{
if (searchBar.Text=="")
searchBar.SetShowsCancelButton (false, true);
//container.FinishSearch ();
}
示例7: OnEditingStarted
public override void OnEditingStarted (UISearchBar searchBar)
{
searchBar.SetShowsCancelButton (true, true);
container.StartSearch ();
}
示例8: CancelButtonClicked
public override void CancelButtonClicked (UISearchBar searchBar)
{
searchBar.Text = "";
if (container.AutoHideSearch && container.EnableSearch) {
searchBar.SetShowsCancelButton(false, false);
if (container.TableView.ContentOffset.Y < 44)
container.TableView.ContentOffset = new PointF (0, 44);
} else {
searchBar.SetShowsCancelButton(false, true);
}
container.FinishSearch ();
searchBar.ResignFirstResponder ();
}
示例9: OnEditingStopped
public override void OnEditingStopped (UISearchBar searchBar)
{
if (String.IsNullOrEmpty(searchBar.Text)) {
searchBar.SetShowsCancelButton(false, true);
container.FinishSearch ();
}
}