Skip to content

Commit

Permalink
Merge pull request #7892 from hansemannn/TIMOB-20625-5_3_X
Browse files Browse the repository at this point in the history
[TIMOB-20625] (5_3_X) iOS: Fix storyboard-usage in Ti.App.forceSplashAsSnapshot
  • Loading branch information
pec1985 committed Mar 31, 2016
2 parents c1fd31d + 71a81fe commit 8309c3a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
29 changes: 22 additions & 7 deletions iphone/Classes/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,15 @@ - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application

-(void)applicationWillResignActive:(UIApplication *)application
{
if([self forceSplashAsSnapshot]) {
[window addSubview:[self splashScreenImage]];
}
if([self forceSplashAsSnapshot]) {
#ifdef LAUNCHSCREEN_STORYBOARD
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIViewController *vc = [sb instantiateInitialViewController];
[[[self controller] topPresentedController] presentViewController:vc animated:NO completion:nil];
#else
[window addSubview:[self splashScreenImage]];
#endif
}
[[NSNotificationCenter defaultCenter] postNotificationName:kTiSuspendNotification object:self];

// suspend any image loading
Expand All @@ -882,10 +888,19 @@ -(void)applicationWillResignActive:(UIApplication *)application

- (void)applicationDidBecomeActive:(UIApplication *)application
{
if(splashScreenImage != nil) {
[[self splashScreenImage] removeFromSuperview];
RELEASE_TO_NIL(splashScreenImage);
}
// We should think about placing this inside "applicationWillBecomeActive" instead to make
// the UI re-useable again more quickly
if([self forceSplashAsSnapshot]) {
#ifdef LAUNCHSCREEN_STORYBOARD
[[[self controller] topPresentedController] dismissViewControllerAnimated:NO completion:nil];
#else
if(splashScreenImage != nil) {
[[self splashScreenImage] removeFromSuperview];
RELEASE_TO_NIL(splashScreenImage);
}
#endif
}

// NOTE: Have to fire a separate but non-'resume' event here because there is SOME information
// (like new URL) that is not passed through as part of the normal foregrounding process.
[[NSNotificationCenter defaultCenter] postNotificationName:kTiResumedNotification object:self];
Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

// MODULES
#define LAUNCHSCREEN_STORYBOARD

#define USE_TI_STREAM
#define USE_TI_CODEC
Expand Down
5 changes: 2 additions & 3 deletions iphone/iphone/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
Expand Down Expand Up @@ -32,7 +32,6 @@
</variation>
</imageView>
</subviews>
<animations/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="oLO-hJ-nXs" firstAttribute="width" secondItem="Ze5-6b-2t3" secondAttribute="width" multiplier="1:2" id="b7h-ZE-BfJ"/>
Expand Down

0 comments on commit 8309c3a

Please sign in to comment.