Edit

Share via


UIControl.GetAppearance Method

Definition

Overloads

GetAppearance(UITraitCollection, Type[])

Returns an appearance proxy for the specified traits when found in the containers containment hierarchy.

GetAppearance(UITraitCollection)

Returns an appearance proxy for the specified traits.

GetAppearance<T>()

Obtains the appearance proxy UIControl.UIControlAppearance for the subclass of UIControl.

GetAppearance<T>(UITraitCollection)

Obtains the appearance proxy UIControl.UIControlAppearance for the subclass of UIControl.

GetAppearance<T>(UITraitCollection, Type[])

Obtains the appearance proxy UIControl.UIControlAppearance for the subclass of UIControl that has the specified trait collection when the view is hosted in the specified hierarchy.

GetAppearance(UITraitCollection, Type[])

Returns an appearance proxy for the specified traits when found in the containers containment hierarchy.

public static UIKit.UIControl.UIControlAppearance GetAppearance (UIKit.UITraitCollection traits, params Type[] containers);
static member GetAppearance : UIKit.UITraitCollection * Type[] -> UIKit.UIControl.UIControlAppearance

Parameters

containers
Type[]

Returns

Applies to

GetAppearance(UITraitCollection)

Returns an appearance proxy for the specified traits.

public static UIKit.UIControl.UIControlAppearance GetAppearance (UIKit.UITraitCollection traits);
static member GetAppearance : UIKit.UITraitCollection -> UIKit.UIControl.UIControlAppearance

Parameters

Returns

Applies to

GetAppearance<T>()

Obtains the appearance proxy UIControl.UIControlAppearance for the subclass of UIControl.

public static UIKit.UIControl.UIControlAppearance GetAppearance<T> () where T : UIKit.UIControl;
static member GetAppearance : unit -> UIKit.UIControl.UIControlAppearance (requires 'T :> UIKit.UIControl)

Type Parameters

T

The type for which the UIAppearance proxy must be returned. This is a subclass of UIControl.

Returns

appearance proxy object for the specified type.

Remarks

Setting any appearance properties on the returned object will affect the appearance of all classes and subclasses of the type parameter.

Unlike the Appearance property, or the AppearanceWhenContainedIn(Type[]) method which only work on instances of this particular class, the proxies returned by GetAppearance can be used to change the style of subclasses.

The following example shows how the GetAppearance method works

var myTheme = UIControl.GetAppearance<MyUIControlSubclass> ();
myTheme.TintColor = UIColor.Red;

For more information, see the documentation for the UIAppearance class.

Applies to

GetAppearance<T>(UITraitCollection)

Obtains the appearance proxy UIControl.UIControlAppearance for the subclass of UIControl.

public static UIKit.UIControl.UIControlAppearance GetAppearance<T> (UIKit.UITraitCollection traits) where T : UIKit.UIControl;
static member GetAppearance : UIKit.UITraitCollection -> UIKit.UIControl.UIControlAppearance (requires 'T :> UIKit.UIControl)

Type Parameters

T

The type for which the UIAppearance proxy must be returned. This is a subclass of UIControl.

Parameters

traits
UITraitCollection

Trait collection to match.

Returns

appearance proxy object for the specified type.

Remarks

The returned object represents the UIAppearance proxy where developers can set appearance properties for instances of UIControl.

Unlike the Appearance property, or the AppearanceWhenContainedIn(Type[]) method which only work on instances of this particular class, the proxies returned by GetAppearance can be used to change the style of subclasses.

The following example shows how the GetAppearance method works

var myTheme = UIControl.GetAppearance<MyUIControlSubclass> (myTraits, );
myTheme.TintColor = UIColor.Red;

For more information, see the documentation for the UIAppearance class.

Applies to

GetAppearance<T>(UITraitCollection, Type[])

Obtains the appearance proxy UIControl.UIControlAppearance for the subclass of UIControl that has the specified trait collection when the view is hosted in the specified hierarchy.

public static UIKit.UIControl.UIControlAppearance GetAppearance<T> (UIKit.UITraitCollection traits, params Type[] containers) where T : UIKit.UIControl;
static member GetAppearance : UIKit.UITraitCollection * Type[] -> UIKit.UIControl.UIControlAppearance (requires 'T :> UIKit.UIControl)

Type Parameters

T

The type for which the UIAppearance proxy must be returned. This is a subclass of UIControl.

Parameters

traits
UITraitCollection

Trait collection to match.

containers
Type[]

List of types that the developer wishes to have as the containers to apply this particular appearance.

Returns

appearance proxy object for the specified type.

Remarks

The returned object represents the UIAppearance proxy where developers can set appearance properties for instances of UIControl that has the specified trait collection when the view is hosted in the specified hierarchy when those instances are contained in the hierarchy specified by the containers parameter.

Unlike the Appearance property, or the AppearanceWhenContainedIn(Type[]) method which only work on instances of this particular class, the proxies returned by GetAppearance can be used to change the style of subclasses.

The following example shows how the GetAppearance method works

var myTheme = UIControl.GetAppearance<MyUIControlSubclass> (myTraits, typeof (UINavigationBar), typeof (UIPopoverController));
myTheme.TintColor = UIColor.Red;

For more information, see the documentation for the UIAppearance class.

Applies to