Giter VIP home page Giter VIP logo

sksplashview's Introduction

SKSplashView

SKSplashView is a simple class to create beautiful animated splash views for transitioning between views. Perfect as a launch screen while your app loads.

The splash view allows you to create an animated background view with preset animations with the option of adding a splash icon that will animate as long as the splash view is animating.

Installation

Cocoapods

SKSplashView is available through Cocoapods. To install it, simply add the following to your Podfile.
pod 'SKSplashView'

Alternative

If installation through Cocoapods doesn't work or if you aren't comfortable using it, you can always just drag and drop the folder 'SKSplashView' into your project and `#import "SKSplashView.h"` and you're ready to go.

Implementation

SKSplashView

Simply create an instance of SKSplashView with the desired customizability option.
SKSplashView *splashView = [[SKSplashView alloc] initWithBackgroundColor:[UIColor blueColor] animationType:SKSplashAnimationTypeZoom];
// the splashView can be initialized with a variety of animation types and backgrounds. See customizability for more.
splashView.animationDuration = 3.0f; //Set the animation duration (Default: 1s)
[self.view addSubview:splashView]; //Add the splash view to your current view
[splashView startAnimation]; //Call this method to start the splash animation

Customizability

The appearance of the splash view can be customized with the following properties:
@property (strong, nonatomic) UIImage *backgroundImage; //Sets a background image to the splash view
@property (nonatomic, assign) CGFloat animationDuration; //Sets the duration of the splash view

The splash view also allows you to customize the animation transition of the splash view with the following types:

SKSplashAnimationTypeFade,
SKSplashAnimationTypeBounce,
SKSplashAnimationTypeShrink,
SKSplashAnimationTypeZoom,
SKSplashAnimationTypeNone

SKSplashIcon

In addition to adding an animated splash view, you can also add an icon on your splash view with its own customizability options that will animate as long as the splash view is running. To add a splash icon to your splash view:

  1. #import "SKSplashIcon.h" in the view you are presenting the splash view

  2. Initialize the splash icon as follows:

SKSplashIcon *splashIcon = [[SKSplashIcon alloc] initWithImage:[UIImage imageNamed:@"test.png"] animationType:SKIconAnimationTypeNone]; 
//Initialize with the customizability option of your choice. See Customizability for more.
  1. Add the splash icon when you are initializing your splash view
  SKSplashView *splashView = [SKSplashView alloc] initWithSplashIcon:splashIcon backgroundColor:splashColor animationType:SKSplashAnimationTypeFade];

Customizability

The appearance of the splash icon can be customized with the following properties:

@property (strong, nonatomic) UIColor *iconColor; //Sets the icon color of the icon (Default: white)
@property (nonatomic, assign) CGSize iconSize; //Sets the size of the icon (Default: 60x60)

The animation of the splash icon can also be customized with the following animation types:

SKIconAnimationTypeBounce,
SKIconAnimationTypeGrow,
SKIconAnimationTypeShrink,
SKIconAnimationTypeFade,
SKIconAnimationTypePing,
SKIconAnimationTypeBlink,
SKIconAnimationTypeNone

Delegate

You can optionally add the SplashView delegate to your view controller to listen to when the splash view begins and ends animating. To do this:
  • Add <SKSplashDelegate> to your interface

  • Set the delegate to your splash view splashView.delegate = self;

  • Add the following methods to listen to updates

- (void) splashView:(SKSplashView *)splashView didBeginAnimatingWithDuration:(float)duration
{
  NSLog(@"Splash view started animating with duration %f", duration);
}

- (void) splashViewDidEndAnimating:(SKSplashView *)splashView
{
  NSLog(@"Splash view stopped animating");
}

Special Feature

SKSplashView also allows you to run a splash animation while executing a network request. This is ideal in situations where your app takes time during launch to download necessary data. By simply calling:
[splashView startAnimationWhileExecuting:request withCompletion:^(NSData *data, NSURLResponse *response, NSError *error) {}];

with an initialized splash view, the splash animation will repeat until you've downloaded everything you need to get started!

Note: This feature currently does not allow animation of the splash view itself but allows for certain splash icon animations.

Example

Some examples of splash views created using SKSplashView (Twitter iOS app and Ping iOS app). All code to the examples is available in the Demo. If you found a way to mimic another popular iOS app's splash view using SKSplashView, let me know so I can add it here.

For more help getting started with SKSplashView, check out the Demo.

Community

If you feel you can improve or add more customizability to SKSplashView, feel free to raise an issue/submit a PR. For any questions, reach out to me on Twitter @_sachink

License

SKSplashView is available under the MIT License

sksplashview's People

Contributors

sachinkesiraju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sksplashview's Issues

Remove use of NSNotificationCenter

you always have the instances of SKSplashView and SKSplashIcon handy so you can call their functions without the need for NSNotificationCenter. You can also add a callback to any function where you ned to know when its done (ie stopAnimation for SKSplashIcon)

iconSize Property doesn't work

Hello!

First thanks for open sourcing your lib! :) Sadly the iconSize property doesn't seem to work. It doesn't reflect any size in the debug and also the setter doesn't do anything on the size. Currently it's hard to fit splash screen icon size with animated icon size. :(

NSInvalidArgumentException crash

UPDATED:

HI there, I'm using version 0.1.1 and there are a some exception risen in iPad Air and iPhones with iOS 8.4

Do you have any clue why is the notification getting lost?

Thanks

Fatal Exception: NSInvalidArgumentException
-[_UIToolbarBackground receiveNotification:]: unrecognized selector sent to instance 0x145d3d090

Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x182fe822c exceptionPreprocess
1 libobjc.A.dylib 0x194a580e4 objc_exception_throw
2 CoreFoundation 0x182fef2f4 __methodDescriptionForSelector
3 CoreFoundation 0x182fec0a8 __forwarding

4 CoreFoundation 0x182eee96c _CF_forwarding_prep_0
5 CoreFoundation 0x182f8e010 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER
6 CoreFoundation 0x182ecb0f0 _CFXNotificationPost
7 Foundation 0x183dfaa80 -[NSNotificationCenter postNotificationName:object:userInfo:]
8 Rentalia 0x1003ff964 -SKSplashView startAnimation
9 Rentalia 0x1000c3f10 -RLHomeViewController splashScreenAnimation
10 Rentalia 0x1000c3bd0 -RLHomeViewController viewDidLoad
11 UIKit 0x187a64a6c -[UIViewController loadViewIfRequired]
12 UIKit 0x187b1ad50 -[UINavigationController _layoutViewController:]
13 UIKit 0x187b1ac4c -[UINavigationController _updateScrollViewFromViewController:toViewController:]
14 UIKit 0x187b1a0d8 -[UINavigationController _startTransition:fromViewController:toViewController:]
15 UIKit 0x187b19d84 -[UINavigationController _startDeferredTransitionIfNeeded:]
16 UIKit 0x187b19aa4 -[UINavigationController __viewWillLayoutSubviews]
17 UIKit 0x187b19a24 -[UILayoutContainerView layoutSubviews]
18 UIKit 0x187a61548 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]

Appdelegate Launch

there any way to declare this code in appdelagate that functions as a launch image

Is it possible to initialize Splash with background View

Hello,
I have an idea, maybe you thought this one before, actually i dont know is it possible or not but let me explain;
Instead of this

  • (instancetype) initWithSplashIcon:(SKSplashIcon *)icon backgroundImage:(UIImage *) backgroundImage animationType:(SKSplashAnimationType) animationType;
    can we add a feature like this?
  • (instancetype) initWithSplashIcon:(SKSplashIcon *)icon backgroundView:(UIIView *) backView animationType:(SKSplashAnimationType) animationType;
    Have you ever tried to code an init method like this one?

tapping on icon zooms it

when tapping is done on the icon . it makes it to zoom to a large extend. calling pingSplash method

xCode 7 beta 5 warning for synthesis

In SKSplashIcon.m, animationDuration var is not synthesized. I keep getting this warning:

Auto property synthesis will not synthesize 'animationDuration'; it will be implemented by it's superclass, use @dynamic to acknowledge intention.

If you synthesize animationDuration, the warning goes away.

iPhone 4S

The animation on iPhone 4S is very quickly

Support with NSOperationQueue

On my initial screen, I run multiple NSOperations in concurrence. I would like to animate while the queue has operations executing.

New Twitter Animation

Hi,

The new animation just zooms in and just pops away and shows the background. Your GIF shows the zoom but after the background goes away.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.