Skip to content
This repository has been archived by the owner on Dec 16, 2017. It is now read-only.

Commit

Permalink
First release of the 2013 version.
Browse files Browse the repository at this point in the history
Attention: The previous version lives in the legacy branch.

This is a bulk commit. The interface has changed and project was updated for the current iOS SDK.

This version is untested and has most definitely bugs.

Signed-off-by: Marcel Dierkes <marcel.dierkes@gmail.com>
  • Loading branch information
newmarcel committed Apr 18, 2013
1 parent 82bf264 commit 8bf9140
Show file tree
Hide file tree
Showing 39 changed files with 1,098 additions and 5,928 deletions.
4 changes: 2 additions & 2 deletions ExampleProject/AppDelegate.h
Expand Up @@ -12,7 +12,7 @@

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow * window;
@property (strong, nonatomic) MKDSlideViewController * slideViewController;
@property (nonatomic, retain) UIWindow * window;
@property (nonatomic, retain) MKDSlideViewController * slideViewController;

@end
55 changes: 9 additions & 46 deletions ExampleProject/AppDelegate.m
Expand Up @@ -7,48 +7,30 @@
//

#import "AppDelegate.h"

#import "MKDSlideViewController.h"
#import "MainViewController.h"
#import "LeftViewController.h"
#import "RightViewController.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize slideViewController = _viewController;

- (void)dealloc
{
[_window release];
[_viewController release];
[_slideViewController release];
[super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

// Override point for customization after application launch.
/*if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[[MKDSlideViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
} else {
self.viewController = [[[MKDSlideViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
}*/

MainViewController * mainVc = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.slideViewController = [[[MKDSlideViewController alloc] initWithRootViewController:mainVc] autorelease];
UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];

// Left & Right
LeftViewController * vcLeft = [[LeftViewController alloc] initWithNibName:@"LeftViewController" bundle:nil];
vcLeft.mainViewController = mainVc; // assign weak reference to main view controller
RightViewController * vcRight = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil];
[self.slideViewController setLeftViewController:vcLeft rightViewController:vcRight];
UIViewController * mainViewController = [storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
UIViewController * leftViewController = [storyboard instantiateViewControllerWithIdentifier:@"LeftViewController"];
UIViewController * rightViewController = [storyboard instantiateViewControllerWithIdentifier:@"RightViewController"];

[vcLeft release];
[vcRight release];
[mainVc release];
_slideViewController = [[MKDSlideViewController alloc] initWithMainViewController:mainViewController];
_slideViewController.leftViewController = leftViewController;
_slideViewController.rightViewController = rightViewController;

self.window.rootViewController = self.slideViewController;
[self.window makeKeyAndVisible];
Expand All @@ -57,41 +39,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

- (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
14 changes: 4 additions & 10 deletions ExampleProject/LeftViewController.h
@@ -1,19 +1,13 @@
//
// ViewController.h
// LeftViewController.h
// MKDSlideViewController
//
// Created by Marcel Dierkes on 03.12.11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// Created by Marcel Dierkes on 18.04.13.
//
//

#import <UIKit/UIKit.h>

@interface LeftViewController : UIViewController

@property (nonatomic, assign) UIViewController * mainViewController;

- (IBAction)changeText:(id)sender;
- (IBAction)navigateToMainViewController:(id)sender;
- (IBAction)navigateToRightViewController:(id)sender;
@interface LeftViewController : UITableViewController

@end
110 changes: 31 additions & 79 deletions ExampleProject/LeftViewController.m
@@ -1,97 +1,49 @@
//
// ViewController.m
// LeftViewController.m
// MKDSlideViewController
//
// Created by Marcel Dierkes on 03.12.11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// Created by Marcel Dierkes on 18.04.13.
//
//

#import "LeftViewController.h"
#import "MainViewController.h"
#import "AppDelegate.h"
#import "MKDSlideViewController.h"
#import "UIViewController+MKDSlideViewController.h"
#import "MainViewController.h"
#import "SecondaryViewController.h"

@implementation LeftViewController

@synthesize mainViewController = _mainViewController;

- (void)didReceiveMemoryWarning
{
[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, typically from a nib.
}

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

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
#pragma mark - Table view delegate

- (void)viewDidDisappear:(BOOL)animated
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
NSUInteger row = [indexPath row];

UINavigationController * centerNavigationController = (UINavigationController *)self.navigationController.slideViewController.mainViewController;

if( row == 0 )
{
if( [centerNavigationController.topViewController isKindOfClass:[MainViewController class]] )
[self.navigationController.slideViewController showMainViewControllerAnimated:YES];
else
{
UIViewController * mainViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
[self.navigationController.slideViewController setMainViewController:mainViewController animated:YES];
}
}
}

#pragma mark -

- (IBAction)changeText:(id)sender
{
MainViewController * main = (MainViewController *)self.mainViewController;
if( self.mainViewController )
else if( row == 1 )
{
[main setDetailText:@"Pressed a button…"];
if( [centerNavigationController.topViewController isKindOfClass:[SecondaryViewController class]] )
[self.navigationController.slideViewController showMainViewControllerAnimated:YES];
else
{
UIViewController * secondaryViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondaryViewController"];
[self.navigationController.slideViewController setMainViewController:secondaryViewController animated:YES];
}
}
}

- (IBAction)navigateToMainViewController:(id)sender
{
// Use the application delegate to interact with the Slide View Controller
AppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
MKDSlideViewController * slideViewController = appDelegate.slideViewController;
[slideViewController showMainViewController:self];
}

- (IBAction)navigateToRightViewController:(id)sender
{
// Use the application delegate to interact with the Slide View Controller
AppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
MKDSlideViewController * slideViewController = appDelegate.slideViewController;
[slideViewController showRightViewController:self];

[tableView deselectRowAtIndexPath:indexPath animated:YES];
}

@end

0 comments on commit 8bf9140

Please sign in to comment.