Permalink
Browse files

A little cleanup. fixed a few bugs.

  • Loading branch information...
coreyfloyd committed Mar 14, 2010
1 parent 7102412 commit fad0acac02b51d4f20050744223fd4cd7cfefdec
@@ -16,6 +16,10 @@ @implementation AnotherViewController
- (IBAction)pop{
+ self.keyedViewController.animationType = FJSAnimationTypeBack;
+ self.keyedViewController.animationDirection = FJSAnimationDirectionLeft;
+ self.keyedViewController.animationDuration = 1.0;
+
[self.keyedViewController loadControllerForKey:@"Dummy"];
}
@@ -90,11 +90,8 @@
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC45Njg3OTAwNTQzIDAuNzQxMjIxMDEwNyAwLjIxMjc0Mjg4AA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
@@ -199,7 +196,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6</int>
+ <int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
View
@@ -1,41 +0,0 @@
-#import <UIKit/UIKit.h>
-
-typedef enum {
- DrawerControllerCollapseTop = 0,
- DrawerControllerCollapseBottom = 1,
-} DrawerControllerCollapseMode;
-
-typedef enum {
- DrawerControllerCloseButtonTopLeft = 0,
- DrawerControllerCloseButtonTopRight = 1,
- DrawerControllerCloseButtonBottomRight = 2,
- DrawerControllerCloseButtonBottomLeft = 3,
-} DrawerControllerCloseButtonLocation;
-
-
-
-@interface DrawerController : UIViewController {
-
- CGRect frame;
- DrawerControllerCollapseMode collapseMode;
- DrawerControllerCloseButtonLocation closeButtonLocation;
- UIButton *closeButton;
-
- UIViewController *viewController;
- BOOL isCollapsed;
-}
-
-- (id)initWithFrame:(CGRect)frame;
-
-@property (nonatomic, assign) CGRect frame;
-@property (nonatomic, assign) DrawerControllerCollapseMode collapseMode;
-@property (nonatomic, assign) DrawerControllerCloseButtonLocation closeButtonLocation;
-
-- (void) expandWithViewController:(UIViewController *)vc animated:(BOOL)animated;
-- (void) collapse:(BOOL)animated;
-- (IBAction) collapseAnimated:(id)sender;
-
-@property (nonatomic, readonly, assign) BOOL isCollapsed;
-@property (nonatomic, readonly, retain) UIViewController *viewController;
-
-@end
View
@@ -1,202 +0,0 @@
-#import "DrawerController.h"
-
-#define kCloseButtonSize 30
-#define kCloseButtonMargin 5
-#define kAnimationDuration 0.5
-
-
-@interface DrawerController ()
-@property (nonatomic, readwrite, retain) UIViewController *viewController;
-@property (nonatomic, readwrite, assign) BOOL isCollapsed;
-@property (nonatomic, retain) UIButton *closeButton;
-@end
-
-@implementation DrawerController
-
-@synthesize viewController;
-@synthesize collapseMode;
-@synthesize isCollapsed;
-@synthesize frame;
-@synthesize closeButtonLocation;
-@synthesize closeButton;
-
-
-/*
- // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
- if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
- // Custom initialization
- }
- return self;
-}
-*/
-
-- (id)initWithFrame:(CGRect)aframe;
-{
- self = [super init];
- if (self != nil) {
- frame = aframe;
- isCollapsed = YES;
- }
- return self;
-}
-
-
-
-- (void)dealloc {
- [closeButton release], closeButton = nil;
- [viewController release], viewController = nil;;
- [super dealloc];
-}
-
-- (CGPoint) centerPointForCloseButton{
-
- if( self.closeButtonLocation == DrawerControllerCloseButtonTopLeft )
- return CGPointMake(kCloseButtonSize/2 + kCloseButtonMargin,
- kCloseButtonSize/2 + kCloseButtonMargin);
-
- else if( self.closeButtonLocation == DrawerControllerCloseButtonTopRight )
- return CGPointMake(self.view.bounds.size.width - (kCloseButtonSize/2 + kCloseButtonMargin),
- kCloseButtonSize/2 + kCloseButtonMargin);
-
- else if( self.closeButtonLocation == DrawerControllerCloseButtonBottomRight )
- return CGPointMake(self.view.bounds.size.width - (kCloseButtonSize/2 + kCloseButtonMargin),
- self.view.bounds.size.height - (kCloseButtonSize/2 + kCloseButtonMargin));
-
- else if( self.closeButtonLocation == DrawerControllerCloseButtonBottomLeft )
- return CGPointMake(kCloseButtonSize/2 + kCloseButtonMargin,
- self.view.bounds.size.height - (kCloseButtonSize/2 + kCloseButtonMargin));
-
- // return something weird for the default
- return self.view.center;
-}
-
-
-- (void)loadView {
- UIView *containerView = [[UIView alloc] initWithFrame:self.frame];
- containerView.userInteractionEnabled = NO;
- containerView.clipsToBounds = YES;
- self.view = containerView;
- [containerView release];
-
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.frame = CGRectMake( 0, 0, kCloseButtonSize, kCloseButtonSize );
- button.center = [self centerPointForCloseButton];
- button.enabled = NO;
- button.alpha = 0.0;
- [button setImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal];
- [button addTarget:self action:@selector(collapseAnimated:) forControlEvents:UIControlEventTouchUpInside];
- self.closeButton = button;
- [self.view addSubview:self.closeButton];
-}
-
-/*
-// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
-- (void)viewDidLoad {
- [super viewDidLoad];
-}
-*/
-
-/*
-// Override to allow orientations other than the default portrait orientation.
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-*/
-
-- (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.
-}
-
-- (void)viewDidUnload {
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
-}
-
-- (void) expandWithViewController:(UIViewController *)vc animated:(BOOL)animated {
-
- if( !self.isCollapsed )
- return;
-
- self.viewController = vc;
- [self.view addSubview:self.viewController.view];
-
- if( animated ) {
-
- CGRect startFrame = self.view.bounds;
-
- if( self.collapseMode == DrawerControllerCollapseTop ) {
- startFrame.origin.y -= startFrame.size.height;
- } else {
- startFrame.origin.y += startFrame.size.height;
- }
-
- self.viewController.view.frame = startFrame;
-
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:kAnimationDuration];
- }
-
- self.viewController.view.frame = self.view.bounds;
-
- if( animated ) {
- [UIView commitAnimations];
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:kAnimationDuration];
- }
-
- [self.view bringSubviewToFront:self.closeButton];
- self.closeButton.enabled = YES;
- self.closeButton.alpha = 1.0;
-
- if( animated ) {
- [UIView commitAnimations];
- }
-
- self.isCollapsed = NO;
-}
-
-- (IBAction) collapseAnimated:(id)sender
-{
- [self collapse:YES];
-}
-
-
-- (void) collapse:(BOOL)animated {
-
- if( self.isCollapsed )
- return;
-
- if( animated ) {
-
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:kAnimationDuration];
-
- }
-
- CGRect newFrame = self.viewController.view.frame;
- if( self.collapseMode == DrawerControllerCollapseTop ) {
- newFrame.origin.y -= newFrame.size.height;
- } else {
- newFrame.origin.y += newFrame.size.height;
- }
-
- self.viewController.view.frame = newFrame;
-
- if( animated ) {
- [UIView commitAnimations];
- }
-
- self.closeButton.alpha = 0.0;
- self.closeButton.enabled = NO;
-
- self.isCollapsed = YES;
-}
-
-
-
-@end
@@ -14,34 +14,12 @@ @implementation DummyViewController
- (IBAction)newxtVC{
-
+ self.keyedViewController.animationType = FJSAnimationTypeFall;
+ self.keyedViewController.animationDuration = 1.0;
+
[self.keyedViewController loadControllerForKey:@"Another"];
}
-/*
- // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
- if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
- // Custom initialization
- }
- return self;
-}
-*/
-
-/*
-// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
-- (void)viewDidLoad {
- [super viewDidLoad];
-}
-*/
-
-/*
-// Override to allow orientations other than the default portrait orientation.
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
@@ -73,11 +73,8 @@
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
+ <int key="NSColorSpace">2</int>
+ <bytes key="NSRGB">MC44MTE3NjQ3NzY3IDAuMTQ5MDE5NjEzOSAwLjE2ODYyNzQ1NTgAA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
@@ -174,7 +171,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5</int>
+ <int key="maxID">6</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -39,6 +39,7 @@ typedef enum {
FJSAnimationType animationType;
FJSAnimationDirection animationDirection;
+ float animationDuration;
}
@property(nonatomic,readonly,retain)UIViewController *currentViewController;
@property(nonatomic,readonly,retain)NSString *currentViewControllerKey;
@@ -50,6 +51,7 @@ typedef enum {
@property(nonatomic,assign)FJSAnimationType animationType;
@property(nonatomic,assign)FJSAnimationDirection animationDirection;
+@property(nonatomic,assign)float animationDuration;
- (void)setController:(UIViewController*)controller forKey:(NSString*)key;
Oops, something went wrong.

0 comments on commit fad0aca

Please sign in to comment.