Permalink
Browse files

Merge pull request #29 from burtlo/storyboard-example

Add Storyboard example
  • Loading branch information...
2 parents 1dcbed1 + 6eb0a21 commit 1cc8e240fd3131eb4379dd9dca3dba2cf3db6305 @steipete committed Aug 16, 2012

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,15 @@
+//
+// PSAppDelegate.h
+// PSStackedStoryboardExample
+//
+// Created by Franklin Webber on 3/26/12.
+// Copyright (c) 2012 University of Washington. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface PSAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@end
@@ -0,0 +1,48 @@
+//
+// PSAppDelegate.m
+// PSStackedStoryboardExample
+//
+// Created by Franklin Webber on 3/26/12.
+// Copyright (c) 2012 University of Washington. All rights reserved.
+//
+
+#import "PSAppDelegate.h"
+
+@implementation PSAppDelegate
+
+@synthesize window = _window;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.psstackedview.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIMainStoryboardFile</key>
+ <string>MainStoryboard_iPhone</string>
+ <key>UIMainStoryboardFile~ipad</key>
+ <string>MainStoryboard_iPad</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'PSStackedStoryboardExample' target in the 'PSStackedStoryboardExample' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_5_0
+#warning "This project uses features only available in iOS SDK 5.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,21 @@
+//
+// PSViewController.h
+// PSStackedStoryboardExample
+//
+// Created by Franklin Webber on 3/26/12.
+// Copyright (c) 2012 University of Washington. All rights reserved.
+//
+
+#import "PSStackedViewController.h"
+
+@interface PSViewController : UIViewController
+
+@property (nonatomic,assign) BOOL showBackButton;
+@property (weak, nonatomic) IBOutlet UIButton *backButton;
+
+- (IBAction)addRedViewController:(id)sender;
+- (IBAction)addGreenViewController:(id)sender;
+- (IBAction)addBlueViewController:(id)sender;
+
+- (IBAction)goBack:(id)sender;
+@end
@@ -0,0 +1,66 @@
+//
+// PSViewController.m
+// PSStackedStoryboardExample
+//
+// Created by Franklin Webber on 3/26/12.
+// Copyright (c) 2012 University of Washington. All rights reserved.
+//
+
+#import "PSViewController.h"
+#import "UIViewController+PSStackedView.h"
+
+@interface PSViewController ()
+
+@end
+
+@implementation PSViewController
+
+@synthesize showBackButton;
+@synthesize backButton;
+
+#pragma mark - View Lifecycle
+
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+ if (showBackButton) {
+ [[self backButton] setHidden:![self showBackButton]];
+ }
+
+}
+- (void)viewDidUnload {
+ [self setBackButton:nil];
+ [super viewDidUnload];
+}
+
+
+#pragma mark - Actions
+
+- (void)pushViewControllerWithColor:(UIColor *)color {
+
+ PSViewController *viewController = [[PSViewController alloc] init];
+
+ [[viewController view] setBackgroundColor:color];
+ [viewController setShowBackButton:YES];
+
+ [[self stackController] pushViewController:viewController fromViewController:self animated:YES];
+}
+
+
+- (IBAction)addRedViewController:(id)sender {
+ [self pushViewControllerWithColor:[UIColor redColor]];
+}
+
+- (IBAction)addGreenViewController:(id)sender {
+ [self pushViewControllerWithColor:[UIColor greenColor]];
+}
+
+- (IBAction)addBlueViewController:(id)sender {
+ [self pushViewControllerWithColor:[UIColor blueColor]];
+}
+
+- (IBAction)goBack:(id)sender {
+
+ [[self stackController] expandStack:1 animated:YES];
+}
+
+@end
Oops, something went wrong.

0 comments on commit 1cc8e24

Please sign in to comment.