Share via


SKView.GetAppearance 方法

定义

重载

GetAppearance(UITraitCollection, Type[])

返回指定特征和容器层次结构的 UIAppearance 类。

GetAppearance(UITraitCollection)

返回此类的 UIAppearance 类。

GetAppearance<T>()

获取 SKView 子类的外观代理 SKView.SKViewAppearance

GetAppearance<T>(UITraitCollection)

获取 SKView 子类的外观代理 SKView.SKViewAppearance

GetAppearance<T>(UITraitCollection, Type[])

当视图托管在指定的层次结构中时,获取具有指定特征集合的 SKView 子类的外观代理 SKView.SKViewAppearance

GetAppearance(UITraitCollection, Type[])

返回指定特征和容器层次结构的 UIAppearance 类。

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

参数

containers
Type[]

返回

适用于

GetAppearance(UITraitCollection)

返回此类的 UIAppearance 类。

public static SpriteKit.SKView.SKViewAppearance GetAppearance (UIKit.UITraitCollection traits);
static member GetAppearance : UIKit.UITraitCollection -> SpriteKit.SKView.SKViewAppearance

参数

返回

适用于

GetAppearance<T>()

获取 SKView 子类的外观代理 SKView.SKViewAppearance

public static SpriteKit.SKView.SKViewAppearance GetAppearance<T> () where T : SpriteKit.SKView;
static member GetAppearance : unit -> SpriteKit.SKView.SKViewAppearance (requires 'T :> SpriteKit.SKView)

类型参数

T

必须为其返回 UIAppearance 代理的类型。 这是 SKView 的子类。

返回

指定类型的外观代理对象。

注解

对返回的对象设置任何外观属性将影响类型参数的所有类和子类的外观。

Appearance与 属性或AppearanceWhenContainedIn(Type[])方法(仅适用于此特定类的实例)不同,GetAppearance 返回的代理可用于更改子类的样式。

以下示例演示 GetAppearance 方法的工作原理

var myTheme = SKView.GetAppearance<MySKViewSubclass> ();
myTheme.TintColor = UIColor.Red;

有关详细信息,请参阅 UIAppearance 类的文档。

适用于

GetAppearance<T>(UITraitCollection)

获取 SKView 子类的外观代理 SKView.SKViewAppearance

public static SpriteKit.SKView.SKViewAppearance GetAppearance<T> (UIKit.UITraitCollection traits) where T : SpriteKit.SKView;
static member GetAppearance : UIKit.UITraitCollection -> SpriteKit.SKView.SKViewAppearance (requires 'T :> SpriteKit.SKView)

类型参数

T

必须为其返回 UIAppearance 代理的类型。 这是 SKView 的子类。

参数

traits
UITraitCollection

要匹配的特征集合。

返回

指定类型的外观代理对象。

注解

返回的对象表示 UIAppearance 代理,开发人员可在其中设置 SKView 实例的外观属性。

Appearance与 属性或AppearanceWhenContainedIn(Type[])方法(仅适用于此特定类的实例)不同,GetAppearance 返回的代理可用于更改子类的样式。

以下示例演示 GetAppearance 方法的工作原理

var myTheme = SKView.GetAppearance<MySKViewSubclass> (myTraits, );
myTheme.TintColor = UIColor.Red;

有关详细信息,请参阅 UIAppearance 类的文档。

适用于

GetAppearance<T>(UITraitCollection, Type[])

当视图托管在指定的层次结构中时,获取具有指定特征集合的 SKView 子类的外观代理 SKView.SKViewAppearance

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

类型参数

T

必须为其返回 UIAppearance 代理的类型。 这是 SKView 的子类。

参数

traits
UITraitCollection

要匹配的特征集合。

containers
Type[]

开发人员希望用作应用此特定外观的容器的类型列表。

返回

指定类型的外观代理对象。

注解

返回的对象表示 UIAppearance 代理,当视图托管在指定层次结构中时,当这些实例包含在 参数指定的层次结构中时,开发人员可以在该代理中设置具有指定特征集合的 containers SKView 实例的外观属性。

Appearance与 属性或AppearanceWhenContainedIn(Type[])方法(仅适用于此特定类的实例)不同,GetAppearance 返回的代理可用于更改子类的样式。

以下示例演示 GetAppearance 方法的工作原理

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

有关详细信息,请参阅 UIAppearance 类的文档。

适用于