Inherits from SKView
Declared in KKView.h

Overview

Kobold Kit apps use KKView as their view. It provides additional features like the ability to push & pop scenes.

Properties

context

This returns the EAGLContext for the view using a public API call. This enables custom OpenGL code on the Sprite Kit GL context. Note: the context is not valid (is nil) before the view controller’s viewDidAppear: method runs. In other words the viewDidAppear: method is the earliest point where you will get a valid EAGLContext.

@property (atomic, readonly) KKGLContext *context

Return Value

The view’s EAGLContext, or nil if the view controller’s viewDidAppear method hasn’t run yet.

Declared In

KKView.h

model

Model of the view, can be used to store values and objects whose lifetime should be equal to that of the view (ie global values/objects).

@property (atomic, readonly) KKModel *model

Return Value

The view’s model object.

Declared In

KKView.h

sceneStack

The scenes currently suspended in the background.

@property (atomic, readonly) NSArray *sceneStack

Return Value

An array with 1 or more scenes currently suspended. The presented scene is always the lastObject.

Discussion

After the first call to presentScene it will always contains at least the scene that’s currently presented. If sceneStack.count returns 1 then there are currently no scenes in the background.

Declared In

KKView.h

showsNodeAnchorPoints

If YES, will render a dot on the node’s position.

@property (atomic) BOOL showsNodeAnchorPoints

Declared In

KKView.h

showsNodeFrames

If YES, will render node outlines according to their frame property.

@property (atomic) BOOL showsNodeFrames

Declared In

KKView.h

showsPhysicsShapes

If YES, will render physics shape outlines.

@property (atomic) BOOL showsPhysicsShapes

Declared In

KKView.h

Class Methods

showsNodeAnchorPoints

Whether node positions are drawn.

+ (BOOL)showsNodeAnchorPoints

Return Value

Whether node positions are drawn.

Declared In

KKView.h

showsNodeFrames

Whether node frame outlines are drawn.

+ (BOOL)showsNodeFrames

Return Value

Whether node frame outlines are drawn.

Declared In

KKView.h

showsPhysicsShapes

Whether physics shape outlines are drawn.

+ (BOOL)showsPhysicsShapes

Return Value

Whether physics shape outlines are drawn.

Declared In

KKView.h

Instance Methods

popScene

Pops the topmost scene from the stack and presents the new topmost scene.

- (void)popScene

Discussion

If there is only one scene on the stack (the currently presented scene) then this method has no effect.

Declared In

KKView.h

popSceneWithTransition:

Pops the topmost scene from the stack and presents the new topmost scene.

- (void)popSceneWithTransition:(KKTransition *)transition

Parameters

transition

A transition used to animate between the two scenes.

Discussion

If there is only one scene on the stack (the currently presented scene) then this method has no effect.

Declared In

KKView.h

popToRootScene

Pops all scenes from the stack except for the root scene, then presents the root scene.

- (void)popToRootScene

Discussion

If there is only one scene on the stack (the currently presented scene) then this method has no effect.

Declared In

KKView.h

popToRootSceneWithTransition:

Pops all scenes from the stack except for the root scene, then presents the root scene.

- (void)popToRootSceneWithTransition:(KKTransition *)transition

Parameters

transition

A transition used to animate between the two scenes.

Discussion

If there is only one scene on the stack (the currently presented scene) then this method has no effect.

Declared In

KKView.h

popToSceneNamed:

Searches for the first scene with the given name in the scene stack and presents it.

- (void)popToSceneNamed:(NSString *)name

Parameters

name

The name of a scene on the stack to be presented.

Discussion

If there is no scene by this name on the scene stack, then this method has no effect.

Declared In

KKView.h

popToSceneNamed:transition:

Searches for the first scene with the given name in the scene stack and presents it.

- (void)popToSceneNamed:(NSString *)name transition:(KKTransition *)transition

Parameters

name

The name of a scene on the stack to be presented.

transition

A transition used to animate between the two scenes.

Discussion

If there is no scene by this name on the scene stack, then this method has no effect.

Declared In

KKView.h

presentScene:

Presents a scene.

- (void)presentScene:(SKScene *)scene

Parameters

scene

The scene to present.

Discussion

Replaces the topmost scene on the scene stack.

Declared In

KKView.h

presentScene:transition:

Presents a scene.

- (void)presentScene:(SKScene *)scene transition:(SKTransition *)transition

Parameters

scene

The scene to present.

transition

A transition used to animate between the two scenes.

Discussion

Replaces the topmost scene on the scene stack.

Declared In

KKView.h

presentScene:transition:unwindStack:

Presents a scene.

- (void)presentScene:(KKScene *)scene transition:(KKTransition *)transition unwindStack:(BOOL)unwindStack

Parameters

scene

The scene to present.

transition

A transition used to animate between the two scenes.

unwindStack

If YES removes all scenes from the stack before adding the new scene.

Discussion

Replaces the topmost scene on the scene stack.

Declared In

KKView.h

presentScene:unwindStack:

Presents a scene.

- (void)presentScene:(KKScene *)scene unwindStack:(BOOL)unwindStack

Parameters

scene

The scene to present.

unwindStack

If YES removes all scenes from the stack before adding the new scene.

Discussion

If unwindSceneStack is YES, all scenes will be removed from the scene stack before presenting the new scene.

Declared In

KKView.h

pushScene:

Presents a scene, suspends the currently presented scene.

- (void)pushScene:(KKScene *)scene

Parameters

scene

The scene to present.

Discussion

The currently presented scene will be suspended, stops animating but remains in memory. It can be presented again using one of the popScene methods.

Declared In

KKView.h

pushScene:transition:

Presents a scene, suspends the currently presented scene.

- (void)pushScene:(KKScene *)scene transition:(KKTransition *)transition

Parameters

scene

The scene to present.

transition

A transition used to animate between the two scenes.

Discussion

The currently presented scene will be suspended, stops animating but remains in memory. It can be presented again using one of the popScene methods.

Declared In

KKView.h

reloadConfig

Reloads the config files, replacing the existing “config” and “devconfig” entries in the model.

- (void)reloadConfig

Declared In

KKView.h