SHSplashScreen class will allow you to create splash screens with only a few lines of code. You can set the start/end transitions, start/end transition times, idle time, and you can toggle on/off skipOnTouch or transitionOnTouch. This extension subclasses SPSprite, so you can add anything to the splash screen, whether it would be an image, movieclip, or other.
//initialize the splash screen with an idle time of 5.0f and default transitions SHSplashScreen *splashScreen = [SHSplashScreen splashScreenWithTime:5.0f]; //initialize and add an image to the splash screen SPImage *logo = [SPImage imageWithContentsOfFile:@"logo.png"]; [splashScreen addChild:logo]; //add the splash screen to the stage, it will automatically start and automatically remove itself from the stage when finished. [self addChild:splashScreen];
See API Reference.
#include "SHSplashScreen.h"
#import "SHSplashScreen.h"
Inherits from | SPSprite : SPDisplayObjectContainer : SPDisplayObject : SPEventDispatcher : NSObject |
Declared in | SHSplashScreen.h |
SHSplashScreen will function similar to a SPSprite. After initializing, you can add children to the splash screen. Once you add the splash screen to the stage, it will automatically began the transitions. After the splash screen finishes the end transition, it will remove itself from the stage. You can set skipOnTouch or transitionOnTouch to allow users to end the splash screen on touch. You can also listen to each phase of the splash screen by listening to event type SH_EVENT_TYPE_SPLASH_SCREEN, see Events for more detail.
Returns an initialized SHSplashScreen object that contains default properties.
- (id)init
Returns an initialized SHSplashScreen object that contains default properties and sets the idle time given, in seconds.
- (id)initWithTime:(float)time
Returns an auto-released initialized SHSplashScreen object that contains default properties.
+ (SHSplashScreen *)splashScreen
Returns an auto-released initialized SHSplashScreen object that contains default properties and sets the idle time given, in seconds.
+ (SHSplashScreen *)splashScreenWithTime:(float)time
The start transition as SHSplashScreenTransition. See Constants for more detail.
@property (nonatomic, assign) SHSplashScreenTransition startTransition
Default Value
SHSplashScreenTransitionFade
The end transition as SHSplashScreenTransition. See Constants for more detail.
@property (nonatomic, assign) SHSplashScreenTransition endTransition
Default Value
SHSplashScreenTransitionFade
The idle time in seconds, which is after the start transition and before the end transition.
@property (nonatomic, assign) float time
Default Value
2.0f
The start transition time in seconds, which is before the idle time.
@property (nonatomic, assign) float startTransitionTime
Default Value
0.5f
The end transition time in seconds, which is after the idle time.
@property (nonatomic, assign) float endTransitionTime
Default Value
0.5f
Indicates if the splash screen will immediately end and be removed from the stage when the stage is touched.
@property (nonatomic, assign) BOOL skipOnTouch
Default Value
NO
Indicates if the splash screen will begin the end transition when the stage is touched.
@property (nonatomic, assign) BOOL transitionOnTouch
Default Value
YES
The transition for either the start transition or the end transition.
typedef enum { SHSplashScreenTransitionFade, SHSplashScreenTransitionZoom, SHSplashScreenTransitionSlideUp, SHSplashScreenTransitionSlideDown, SHSplashScreenTransitionSlideLeft, SHSplashScreenTransitionSlideRight, SHSplashScreenTransitionFadeUp, SHSplashScreenTransitionFadeDown, SHSplashScreenTransitionFadeLeft, SHSplashScreenTransitionFadeRight, SHSplashScreenTransitionZoomUp, SHSplashScreenTransitionZoomDown, SHSplashScreenTransitionZoomLeft, SHSplashScreenTransitionZoomRight } SHSplashScreenTransition;
SHSplashScreenTransitionFade
SHSplashScreenTransitionZoom
SHSplashScreenTransitionSlideUp
SHSplashScreenTransitionSlideDown
SHSplashScreenTransitionSlideLeft
SHSplashScreenTransitionSlideRight
SHSplashScreenTransitionFadeUp
SHSplashScreenTransitionFadeDown
SHSplashScreenTransitionFadeLeft
SHSplashScreenTransitionFadeRight
SHSplashScreenTransitionZoomUp
SHSplashScreenTransitionZoomDown
SHSplashScreenTransitionZoomLeft
SHSplashScreenTransitionZoomRight
The current phase/state of the transitions.
typedef enum { SHSplashScreenPhaseBegan, SHSplashScreenPhaseStartTransitionEnded, SHSplashScreenPhaseEndTransitionBegan, SHSplashScreenPhaseEnded, } SHSplashScreenPhase;
SHSplashScreenPhaseBegan
SHSplashScreenPhaseStartTransitionEnded
SHSplashScreenPhaseEndTransitionBegan
SHSplashScreenPhaseEndTransitionEnded
An event that gets dispatched when entering each SHSplashScreenPhase. You can listen to the event with event type SH_EVENT_TYPE_SPLASH_SCREEN.
SHSplashScreen *splashScreen = [SHSplashScreen splashScreen]; [splashScreen addEventListener:@selector(onSplashScreenEvent:) atObject:self forType:SH_EVENT_TYPE_SPLASH_SCREEN];