編輯

共用方式為


UIViewController.SearchDisplayController Property

Definition

The UISearchDisplayController, if any, associated with this UIViewController.

[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'UISearchController' instead.")]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual UIKit.UISearchDisplayController SearchDisplayController { [ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'UISearchController' instead.")] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)] [Foundation.Export("searchDisplayController", ObjCRuntime.ArgumentSemantic.Strong)] get; }
member this.SearchDisplayController : UIKit.UISearchDisplayController

Property Value

The default value is null.

Attributes

Remarks

Application developeres may specify a UISearchDisplayController using Interface Builder or programmatically. To assign the SearchDisplayController property, the UIViewController must have a field of type UISearchBar decorated with [Outlet] (OutletAttribute) and must initialize a new UISearchDisplayController with a reference to that UISearchBar. As shown in the following code, the assignment of the UISearchDisplayController to SearchDisplayController is done implicitly during initialization, and does not involve the application developer assigning the reference to the newly-created UISearchDisplayController:

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

    //this.SearchDisplayController == null
    //n.b.: No assignment 
    new UISearchDisplayController (mySearchBar, this);
    //this.SearchDisplayController != null         
    Console.WriteLine ("SearchDisplayController = '{0}'", this.SearchDisplayController);
}

Applies to