Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip committed Feb 15, 2015
0 parents commit 88cd82e
Show file tree
Hide file tree
Showing 59 changed files with 2,937 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .gitignore
@@ -0,0 +1,48 @@
# Created by https://www.gitignore.io

#!! ERROR: o is undefined. Use list command to see defined gitignore types !!#

### Objective-C ###
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/


### Xcode ###
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.xcuserstate
385 changes: 385 additions & 0 deletions Demo/Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Demo/Demo.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Demo/Demo/Demo-Info.plist
@@ -0,0 +1,45 @@
<?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.electrickangaroo.${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>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>
17 changes: 17 additions & 0 deletions Demo/Demo/Demo-Prefix.pch
@@ -0,0 +1,17 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "LightningTable.h"
#endif
15 changes: 15 additions & 0 deletions Demo/Demo/EKDAppDelegate.h
@@ -0,0 +1,15 @@
//
// EKDAppDelegate.h
// Demo
//
// Created by Phillip Caudell on 15/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface EKDAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
25 changes: 25 additions & 0 deletions Demo/Demo/EKDAppDelegate.m
@@ -0,0 +1,25 @@
//
// EKDAppDelegate.m
// Demo
//
// Created by Phillip Caudell on 15/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKDAppDelegate.h"
#import "EKDRootViewController.h"

@implementation EKDAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[EKDRootViewController new]];

[self.window makeKeyAndVisible];

return YES;
}

@end
13 changes: 13 additions & 0 deletions Demo/Demo/EKDBasicDemoViewController.h
@@ -0,0 +1,13 @@
//
// EKDBasicDemoViewController.h
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKTableViewController.h"

@interface EKDBasicDemoViewController : EKTableViewController

@end
67 changes: 67 additions & 0 deletions Demo/Demo/EKDBasicDemoViewController.m
@@ -0,0 +1,67 @@
//
// EKDBasicDemoViewController.m
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKDBasicDemoViewController.h"

@implementation EKDBasicDemoViewController

- (void)viewDidLoad
{
[super viewDidLoad];

self.title = @"Basics";

/*
SIMPLE ROWS
*/

// EKTableRow is a basic object that conforms to the EKTableRowProtocol. By default it comes with all the standard properties of a UITableViewCell.

EKTableRow *row = [EKTableRow rowWithTitle:@"I am a simple row."];
EKTableRow *row2 = [EKTableRow rowWithTitle:@"I am another row." subtitle:@"I have a subtitle. My text can span multiple lines as Lighting Table will automatically calculate the cell heights. Neat!" image:nil];
EKTableRow *row3 = [EKTableRow rowWithTitle:@"I am the best row with a title, subtitle and image!" subtitle:@"Not only do I have a title and subtitle that spans multiple lines, but I also have an image. Check. Mate." image:[UIImage imageNamed:@"TableItem-Heart"]];

// This is a section. It contains rows. Again EKTableSection is a basic object that conforms to the EKTableSection protocol.

EKTableSection *basicSection = [EKTableSection sectionWithHeaderTitle:@"Basic Rows" rows:@[row, row2, row3] footerTitle:nil selection:nil];

/*
ROWS WITH SELECTION
*/

// Rows have selection handlers. These are blocks that get executed when a user makes a selection in the table-view.
// Rows with selection handlers automatically have the detail disclosure indicator added to them; though you can disable this if you want.

EKTableRow *pushyRow = [EKTableRow rowWithTitle:@"I'm a pushy row"];
[pushyRow setSelectionHandler:^(EKTableRowSelection *selection) {

[self presentMessage:@"This message is from the row!"];
}];

// Sections can also have selection handlers. These will apply selection handlers to all rows in the section; unless the row has its own selection handler.

EKTableRow *sectionPushyRow = [EKTableRow rowWithTitle:@"My parent is pushy"];
EKTableRow *sectionPushyRow2 = [EKTableRow rowWithTitle:@"No way, mine too!"];

EKTableSection *selectionSection = [EKTableSection sectionWithHeaderTitle:@"Selection" rows:@[pushyRow, sectionPushyRow, sectionPushyRow2] footerTitle:nil selection:^(EKTableRowSelection *selection) {

[self presentMessage:@"This message is from the section!"];
}];

// Finally we set the sections of the table-view.
self.sections = @[basicSection, selectionSection];
}

- (void)presentMessage:(NSString *)message
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:message message:nil delegate:nil cancelButtonTitle:@"Wow!" otherButtonTitles:nil];
[alertView show];
[self clearSelectionAnimated:YES];
}

@end
13 changes: 13 additions & 0 deletions Demo/Demo/EKDCustomCellViewController.h
@@ -0,0 +1,13 @@
//
// EKDCustomCellViewController.h
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKTableViewController.h"

@interface EKDCustomCellViewController : EKTableViewController

@end
28 changes: 28 additions & 0 deletions Demo/Demo/EKDCustomCellViewController.m
@@ -0,0 +1,28 @@
//
// EKDCustomCellViewController.m
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKDCustomCellViewController.h"
#import "EKDCustomSliderRow.h"

@implementation EKDCustomCellViewController

- (void)viewDidLoad
{
[super viewDidLoad];

EKTableRow *infoRow = [EKTableRow rowWithTitle:@"Below this cell, is a custom cell." subtitle:@"Custom cells have a row class (so it can be declared in the table-view model), and a cell class (what's rendered on screen)." image:nil];

// This is a custom row. Inside this class it implements the EKTableRowProtocol which implements the rowCellClass method. This tells the table-view what cell class to initialise and render in the view.
// In this demo we've made a specific EKDCustomSliderRow object - but this could be any object; most likely a model in your application. For example the EKDNote object could have a custom cell to display a tacky note background.
EKDCustomSliderRow *sliderRow = [EKDCustomSliderRow new];
EKTableSection *section = [EKTableSection sectionWithRows:@[infoRow, sliderRow]];

self.sections = @[section];
}

@end
15 changes: 15 additions & 0 deletions Demo/Demo/EKDCustomObjectViewController.h
@@ -0,0 +1,15 @@
//
// EKDCustomObjectViewController.h
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKTableViewController.h"

@interface EKDCustomObjectViewController : EKTableViewController <UIAlertViewDelegate>

@property (nonatomic, strong) NSArray *notes;

@end
63 changes: 63 additions & 0 deletions Demo/Demo/EKDCustomObjectViewController.m
@@ -0,0 +1,63 @@
//
// EKDCustomObjectViewController.m
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import "EKDCustomObjectViewController.h"
#import "EKDNote.h"

@implementation EKDCustomObjectViewController

- (void)viewDidLoad
{
[super viewDidLoad];

self.title = @"Notes";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(handleAddNote:)];

// Setup an example default note
EKDNote *defaultNote = [EKDNote noteWithText:@"I am a custom EKDNote object; but because I conform the row protocol I can be passed directly into a table-view. Neat."];
self.notes = @[defaultNote];

[self reload];
}

- (void)reload
{
// The notes array contains EKDNote objects. This is a custom object completly seperate from Lightning Tables; but because it conforms to EKTableRowProtocol it can be displayed directly in the table-view. Think of it like the MKAnnotation protocol.
EKTableSection *section = [EKTableSection sectionWithRows:self.notes];

// As we've modified the sections, we'll need to reload the table view.
[self setSections:@[section] reload:YES animated:YES];
}

- (void)addNote:(EKDNote *)note
{
self.notes = [self.notes arrayByAddingObject:note];
[self reload];
}

#pragma mark - Actions

- (void)handleAddNote:(id)sender
{
// Display UI to take a note
UIAlertView *noteView = [[UIAlertView alloc] initWithTitle:@"New Note" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
noteView.alertViewStyle = UIAlertViewStylePlainTextInput;
[noteView show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {

UITextField *textField = [alertView textFieldAtIndex:0];
EKDNote *note = [EKDNote noteWithText:textField.text];
[self addNote:note];
}
}

@end
13 changes: 13 additions & 0 deletions Demo/Demo/EKDCustomSliderRow.h
@@ -0,0 +1,13 @@
//
// EKDCustomSliderRow.h
// Demo
//
// Created by Phillip Caudell on 16/08/2014.
// Copyright (c) 2014 Electric Kangaroo. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface EKDCustomSliderRow : NSObject <EKTableRowProtocol>

@end

0 comments on commit 88cd82e

Please sign in to comment.