Skip to content

Commit

Permalink
Added exploding view controller
Browse files Browse the repository at this point in the history
  • Loading branch information
snarshad committed Jul 17, 2011
1 parent 57e4b96 commit cd200fa
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ExplodingTextViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// ExplodingTextViewController.h
// SongGong
//
// Created by Arshad Tayyeb on 7/17/11.
// Copyright 2011 doubleTwist Corporation. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ExplodingTextViewController : UIViewController {
UILabel *textLabel;
CGRect origRect;
}
+ (id)explodeText:(NSString *)text;
- (void)explodeText:(NSString *)text;

@property (nonatomic, retain) IBOutlet UILabel *textLabel;

@end
97 changes: 97 additions & 0 deletions ExplodingTextViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// ExplodingTextViewController.m
// SongGong
//
// Created by Arshad Tayyeb on 7/17/11.
// Copyright 2011 doubleTwist Corporation. All rights reserved.
//

#import "ExplodingTextViewController.h"
#import "SongGongAppDelegate.h"

@implementation ExplodingTextViewController
@synthesize textLabel;

+ (id)explodeText:(NSString *)text
{
ExplodingTextViewController *vc = [[[ExplodingTextViewController alloc] init] autorelease];
[vc explodeText:text];
return vc;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}

- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
origRect = self.view.frame;
self.view.hidden = YES;
}

- (void)viewDidUnload
{
[self setTextLabel:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

#pragma mark -
- (void)explodeText:(NSString *)text
{
if (!self.view.superview)
{
[[SongGongAppDelegate mainView] addSubview:self.view];
}

[self retain];
[self.view setHidden:YES];
self.view.frame = origRect;
self.textLabel.text = text;
[self.view setHidden:NO];

[UIView beginAnimations:NSStringFromSelector(_cmd) context:nil];

[UIView setAnimationDidStopSelector:@selector(animatePlaylistViewPart2:finished:context:)];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:.25];
[UIView setAnimationDelegate:self];
CGAffineTransform transform = CGAffineTransformMakeScale(5.0,5.0);
self.view.transform = transform;
[UIView commitAnimations];
}

- (void)explodingDone:(NSString *)animationId finished:(BOOL)finished context:(id)context
{
[self.view removeFromSuperview];
[self release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc {
[textLabel release];
[super dealloc];
}
@end
187 changes: 187 additions & 0 deletions ExplodingTextViewController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">10J869</string>
<string key="IBDocument.InterfaceBuilderVersion">1891</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">884</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBProxyObject</string>
<string>IBUILabel</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUILabel" id="565154465">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{240, 120}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Label</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">1</int>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">2</int>
<double key="pointSize">52</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">52</double>
<int key="NSfFlags">16</int>
</object>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="565154465"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">textLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="565154465"/>
</object>
<int key="connectionID">8</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="565154465"/>
<reference key="parent" ref="0"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-1.IBPluginDependency</string>
<string>-2.CustomClassName</string>
<string>-2.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ExplodingTextViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UIResponder</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">8</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ExplodingTextViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">textLabel</string>
<string key="NS.object.0">UILabel</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">textLabel</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">textLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ExplodingTextViewController.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">884</string>
</data>
</archive>
2 changes: 2 additions & 0 deletions SGCarouselViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "OPASpookSoundManager.h"
#import "iCarousel.h"
#import "SGIPodSourceViewController.h"
#import "ExplodingTextViewController.h"

@implementation SGCarouselViewController
@synthesize gestureController;
Expand Down Expand Up @@ -130,6 +131,7 @@ - (void)playPauseToggle:(id)sender
[currentCarouselSource togglePlay:self];
[OPASpookSoundManager playShortSound:@"nav-LeftRight.aiff" disposeWhenDone:NO];

[ExplodingTextViewController explodeText:@""];
}


Expand Down
10 changes: 10 additions & 0 deletions SongGong.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
A7462BA613D3779600C5CEB5 /* mainicons_r_3.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9C13D3779600C5CEB5 /* mainicons_r_3.png */; };
A7462BA713D3779600C5CEB5 /* mainicons_r_4.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9D13D3779600C5CEB5 /* mainicons_r_4.png */; };
A7462BA813D3779600C5CEB5 /* mainicons_r_5.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9E13D3779600C5CEB5 /* mainicons_r_5.png */; };
A7462BAC13D37B7D00C5CEB5 /* ExplodingTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A7462BAA13D37B7D00C5CEB5 /* ExplodingTextViewController.m */; };
A7462BAD13D37B7D00C5CEB5 /* ExplodingTextViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A7462BAB13D37B7D00C5CEB5 /* ExplodingTextViewController.xib */; };
A763031C13D2754C00F7682D /* SGIPodSource.m in Sources */ = {isa = PBXBuildFile; fileRef = A763031B13D2754C00F7682D /* SGIPodSource.m */; };
A7B38D3113D2616A0067C53D /* nav-LeftRight.aiff in Resources */ = {isa = PBXBuildFile; fileRef = A7B38D2E13D2616A0067C53D /* nav-LeftRight.aiff */; };
A7B38D3213D2616A0067C53D /* nav-UpDown.aiff in Resources */ = {isa = PBXBuildFile; fileRef = A7B38D2F13D2616A0067C53D /* nav-UpDown.aiff */; };
Expand Down Expand Up @@ -65,6 +67,9 @@
A7462B9C13D3779600C5CEB5 /* mainicons_r_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_3.png; path = "Resources/carousel icons/mainicons_r_3.png"; sourceTree = SOURCE_ROOT; };
A7462B9D13D3779600C5CEB5 /* mainicons_r_4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_4.png; path = "Resources/carousel icons/mainicons_r_4.png"; sourceTree = SOURCE_ROOT; };
A7462B9E13D3779600C5CEB5 /* mainicons_r_5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_5.png; path = "Resources/carousel icons/mainicons_r_5.png"; sourceTree = SOURCE_ROOT; };
A7462BA913D37B7D00C5CEB5 /* ExplodingTextViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExplodingTextViewController.h; sourceTree = "<group>"; };
A7462BAA13D37B7D00C5CEB5 /* ExplodingTextViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExplodingTextViewController.m; sourceTree = "<group>"; };
A7462BAB13D37B7D00C5CEB5 /* ExplodingTextViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ExplodingTextViewController.xib; sourceTree = "<group>"; };
A763031A13D2754C00F7682D /* SGIPodSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGIPodSource.h; sourceTree = SOURCE_ROOT; };
A763031B13D2754C00F7682D /* SGIPodSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGIPodSource.m; sourceTree = SOURCE_ROOT; };
A7B38D2E13D2616A0067C53D /* nav-LeftRight.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; name = "nav-LeftRight.aiff"; path = "Resources/navSounds/nav-LeftRight.aiff"; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -204,6 +209,9 @@
A7E0001713D15A3D0048B9EC = {
isa = PBXGroup;
children = (
A7462BA913D37B7D00C5CEB5 /* ExplodingTextViewController.h */,
A7462BAA13D37B7D00C5CEB5 /* ExplodingTextViewController.m */,
A7462BAB13D37B7D00C5CEB5 /* ExplodingTextViewController.xib */,
A7E0002C13D15A3D0048B9EC /* SongGong */,
A7E0002513D15A3D0048B9EC /* Frameworks */,
A7E0002313D15A3D0048B9EC /* Products */,
Expand Down Expand Up @@ -348,6 +356,7 @@
A7462BA613D3779600C5CEB5 /* mainicons_r_3.png in Resources */,
A7462BA713D3779600C5CEB5 /* mainicons_r_4.png in Resources */,
A7462BA813D3779600C5CEB5 /* mainicons_r_5.png in Resources */,
A7462BAD13D37B7D00C5CEB5 /* ExplodingTextViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -372,6 +381,7 @@
BC2128A213D2B8250087CE59 /* SGGenericPlayerView.m in Sources */,
BCD1DECA13D2D67E000603F0 /* NSAttributedString+Attributes.m in Sources */,
BCD1DECB13D2D67E000603F0 /* OHAttributedLabel.m in Sources */,
A7462BAC13D37B7D00C5CEB5 /* ExplodingTextViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions SongGongAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{
IBOutlet SGCarouselViewController *mCarouselViewController;
}
+ (UIView *)mainView;
@property (nonatomic, retain) UIWindow *window;

@property (nonatomic, retain) UITabBarController *tabBarController;
Expand Down
8 changes: 8 additions & 0 deletions SongGongAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ @implementation SongGongAppDelegate
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;

static SongGongAppDelegate *s_appDelegate;

+ (UIView *)mainView
{
return s_appDelegate.window.rootViewController.view;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
s_appDelegate = self;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
// UIViewController *viewController1, *viewController2;
Expand Down

0 comments on commit cd200fa

Please sign in to comment.