A view controller which displays the launch image like Zhi Hu Daily.
- Insert
pod 'KCLaunchImage', '~> 0.0.1'
into yourPodfile
. - Type command
pod install
in your terminal. - Done.
- Add
KCLaunchImageViewController.h
andKCLaunchImageViewController.m
into your project(if you install it from pod, just skip this step). - Create a new image set named
FakeLaunchImage
. - Add your own launch image into
LaunchImage
andFakeLaunchImage
separately. - Add your own display image named
displayImage
. - In your
AppDelegate.m
file, add those code.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIImageView *splashScreen = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"FakeLaunchImage"]];
[self.window addSubview:splashScreen];
self.window.rootViewController =
[KCLaunchImageViewController addTransitionToViewController:[[KCViewController alloc] init]
modalTransitionStyle:UIModalTransitionStyleCrossDissolve
withImage:@"displayImage" // your own display image
taskBlock:^(void){
[splashScreen removeFromSuperview];
}];
return YES;
}
The files should be open in Sketch
If your images shored in images.xcassets
, please set Deployment Target
>= 7.0.
kavichen, [email protected]
KCLaunchImage is available under the MIT license. See the LICENSE file for more info.