Permalink
Browse files

GitHub Pages with Screenshots

  • Loading branch information...
1 parent b45d4e5 commit 352b1eac8eaa0a9447c6f17187372fd4d3deee14 @gresrun committed Jan 11, 2012
View
@@ -1,13 +0,0 @@
-//
-// GHAppDelegate.h
-// GHSidebarNav
-//
-// Created by Greg Haines on 11/20/11.
-//
-
-#import <Foundation/Foundation.h>
-#import "GHSidebarSearchViewControllerDelegate.h"
-
-@interface GHAppDelegate : UIResponder <UIApplicationDelegate, GHSidebarSearchViewControllerDelegate>
-
-@end
View
@@ -1,140 +0,0 @@
-//
-// GHAppDelegate.m
-// GHSidebarNav
-//
-// Created by Greg Haines on 11/20/11.
-//
-
-#import "GHAppDelegate.h"
-#import "GHMenuCell.h"
-#import "GHMenuViewController.h"
-#import "GHRootViewController.h"
-#import "GHRevealViewController.h"
-#import "GHSidebarSearchViewController.h"
-
-
-#pragma mark -
-#pragma mark Private Interface
-@interface GHAppDelegate ()
-@property (nonatomic, strong) GHRevealViewController *revealController;
-@property (nonatomic, strong) GHSidebarSearchViewController *searchController;
-@property (nonatomic, strong) GHMenuViewController *menuController;
-@end
-
-
-#pragma mark -
-#pragma mark Implementation
-@implementation GHAppDelegate
-
-#pragma mark Properties
-@synthesize window;
-@synthesize revealController;
-@synthesize searchController;
-@synthesize menuController;
-
-#pragma mark UIApplicationDelegate
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];
-
- UIColor *bgColor = [UIColor colorWithRed:(50.0f/255.0f) green:(57.0f/255.0f) blue:(74.0f/255.0f) alpha:1.0f];
- self.revealController = [[GHRevealViewController alloc] initWithNibName:nil bundle:nil];
- self.revealController.view.backgroundColor = bgColor;
-
- RevealBlock revealBlock = ^(){
- [self.revealController toggleSidebar:!self.revealController.sidebarShowing
- duration:kGHRevealSidebarDefaultAnimationDuration];
- };
-
- NSMutableArray *headers = [[NSMutableArray alloc] initWithCapacity:2];
- NSMutableArray *controllers = [[NSMutableArray alloc] initWithCapacity:2];
- NSMutableArray *cellInfos = [[NSMutableArray alloc] initWithCapacity:2];
-
- NSMutableArray *profileInfos = [[NSMutableArray alloc] initWithCapacity:1];
- NSMutableArray *profileControllers = [[NSMutableArray alloc] initWithCapacity:1];
- [profileInfos addObject:[NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"user.png"], kSidebarCellImageKey,
- NSLocalizedString(@"Profile", @""), kSidebarCellTextKey, nil]];
- [profileControllers addObject:[[UINavigationController alloc] initWithRootViewController:
- [[GHRootViewController alloc] initWithTitle:@"Profile" withRevealBlock:revealBlock]]];
- [headers addObject:[NSNull null]];
- [cellInfos addObject:profileInfos];
- [controllers addObject:profileControllers];
-
- NSMutableArray *favoritesInfos = [[NSMutableArray alloc] initWithCapacity:5];
- NSMutableArray *favoritesControllers = [[NSMutableArray alloc] initWithCapacity:5];
- [favoritesInfos addObject:[NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"user.png"], kSidebarCellImageKey,
- NSLocalizedString(@"News Feed", @""), kSidebarCellTextKey, nil]];
- [favoritesControllers addObject:[[UINavigationController alloc] initWithRootViewController:
- [[GHRootViewController alloc] initWithTitle:@"News Feed" withRevealBlock:revealBlock]]];
- [favoritesInfos addObject:[NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"user.png"], kSidebarCellImageKey,
- NSLocalizedString(@"Messages", @""), kSidebarCellTextKey, nil]];
- [favoritesControllers addObject:[[UINavigationController alloc] initWithRootViewController:
- [[GHRootViewController alloc] initWithTitle:@"Messages" withRevealBlock:revealBlock]]];
- [favoritesInfos addObject:[NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"user.png"], kSidebarCellImageKey,
- NSLocalizedString(@"Nearby", @""), kSidebarCellTextKey, nil]];
- [favoritesControllers addObject:[[UINavigationController alloc] initWithRootViewController:
- [[GHRootViewController alloc] initWithTitle:@"Nearby" withRevealBlock:revealBlock]]];
- [favoritesInfos addObject:[NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"user.png"], kSidebarCellImageKey,
- NSLocalizedString(@"Events", @""), kSidebarCellTextKey, nil]];
- [favoritesControllers addObject:[[UINavigationController alloc] initWithRootViewController:
- [[GHRootViewController alloc] initWithTitle:@"Events" withRevealBlock:revealBlock]]];
- [favoritesInfos addObject:[NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"user.png"], kSidebarCellImageKey,
- NSLocalizedString(@"Friends", @""), kSidebarCellTextKey, nil]];
- [favoritesControllers addObject:[[UINavigationController alloc] initWithRootViewController:
- [[GHRootViewController alloc] initWithTitle:@"Friends" withRevealBlock:revealBlock]]];
- [headers addObject:@"FAVORITES"];
- [cellInfos addObject:favoritesInfos];
- [controllers addObject:favoritesControllers];
-
- // Add drag feature to each root navigation controller
- [controllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop){
- [((NSArray *)obj) enumerateObjectsUsingBlock:^(id obj2, NSUInteger idx2, BOOL *stop2){
- UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.revealController
- action:@selector(dragContentView:)];
- panGesture.cancelsTouchesInView = YES;
- [((UINavigationController *)obj2).navigationBar addGestureRecognizer:panGesture];
- }];
- }];
-
- self.searchController = [[GHSidebarSearchViewController alloc] initWithSidebarViewController:self.revealController];
- self.searchController.view.backgroundColor = [UIColor clearColor];
- self.searchController.searchDelegate = self;
- self.searchController.searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
- self.searchController.searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
- self.searchController.searchBar.backgroundImage = [UIImage imageNamed:@"searchBarBG.png"];
- self.searchController.searchBar.placeholder = NSLocalizedString(@"Search", @"");
- self.searchController.searchBar.tintColor = [UIColor colorWithRed:(58.0f/255.0f) green:(67.0f/255.0f) blue:(104.0f/255.0f) alpha:1.0f];
- for (UIView *subview in self.searchController.searchBar.subviews) {
- if ([subview isKindOfClass:[UITextField class]]) {
- UITextField *searchTextField = (UITextField *) subview;
- searchTextField.textColor = [UIColor colorWithRed:(154.0f/255.0f) green:(162.0f/255.0f) blue:(176.0f/255.0f) alpha:1.0f];
- }
- }
- [self.searchController.searchBar setSearchFieldBackgroundImage:[[UIImage imageNamed:@"searchTextBG.png"]
- resizableImageWithCapInsets:UIEdgeInsetsMake(16.0f, 17.0f, 16.0f, 17.0f)]
- forState:UIControlStateNormal];
- [self.searchController.searchBar setImage:[UIImage imageNamed:@"searchBarIcon.png"]
- forSearchBarIcon:UISearchBarIconSearch
- state:UIControlStateNormal];
-
- self.menuController = [[GHMenuViewController alloc] initWithSidebarViewController:self.revealController
- withSearchBar:self.searchController.searchBar
- withHeaders:headers
- withControllers:controllers
- withCellInfos:cellInfos];
-
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- self.window.rootViewController = self.revealController;
- [self.window makeKeyAndVisible];
- return YES;
-}
-
-#pragma mark GHSidebarSearchViewControllerDelegate
-- (void)searchResultsForText:(NSString *)text withScope:(NSString *)scope callback:(SearchResultsBlock)callback {
- callback([NSArray arrayWithObjects:@"Foo", @"Bar", @"Baz", nil]);
-}
-
-- (void)searchResult:(id)result selectedAtIndexPath:(NSIndexPath *)indexPath {
- NSLog(@"Selected Search Result - result: %@ indexPath: %@", result, indexPath);
-}
-
-@end
View
@@ -1,15 +0,0 @@
-//
-// GHSidebarMenuCell.h
-// GHSidebarNav
-//
-// Created by Greg Haines on 11/20/11.
-//
-
-#import <Foundation/Foundation.h>
-
-extern NSString const *kSidebarCellTextKey;
-extern NSString const *kSidebarCellImageKey;
-
-@interface GHMenuCell : UITableViewCell
-
-@end
View
@@ -1,58 +0,0 @@
-//
-// GHSidebarMenuCell.m
-// GHSidebarNav
-//
-// Created by Greg Haines on 11/20/11.
-//
-
-#import "GHMenuCell.h"
-
-#pragma mark -
-#pragma mark Constants
-NSString const *kSidebarCellTextKey = @"CellText";
-NSString const *kSidebarCellImageKey = @"CellImage";
-
-
-#pragma mark -
-#pragma mark Implementation
-@implementation GHMenuCell
-
-#pragma mark Memory Management
-- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
- self.clipsToBounds = YES;
-
- UIView *bgView = [[UIView alloc] init];
- bgView.backgroundColor = [UIColor colorWithRed:(38.0f/255.0f) green:(44.0f/255.0f) blue:(58.0f/255.0f) alpha:1.0f];
- self.selectedBackgroundView = bgView;
-
- self.imageView.contentMode = UIViewContentModeCenter;
-
- self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:([UIFont systemFontSize] * 1.2f)];
- self.textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
- self.textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f];
- self.textLabel.textColor = [UIColor colorWithRed:(196.0f/255.0f) green:(204.0f/255.0f) blue:(218.0f/255.0f) alpha:1.0f];
-
- UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
- topLine.backgroundColor = [UIColor colorWithRed:(54.0f/255.0f) green:(61.0f/255.0f) blue:(76.0f/255.0f) alpha:1.0f];
- [self.textLabel.superview addSubview:topLine];
-
- UIView *topLine2 = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 1.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
- topLine2.backgroundColor = [UIColor colorWithRed:(54.0f/255.0f) green:(61.0f/255.0f) blue:(77.0f/255.0f) alpha:1.0f];
- [self.textLabel.superview addSubview:topLine2];
-
- UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 43.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
- bottomLine.backgroundColor = [UIColor colorWithRed:(40.0f/255.0f) green:(47.0f/255.0f) blue:(61.0f/255.0f) alpha:1.0f];
- [self.textLabel.superview addSubview:bottomLine];
- }
- return self;
-}
-
-#pragma mark UIView
-- (void)layoutSubviews {
- [super layoutSubviews];
- self.textLabel.frame = CGRectMake(50.0f, 0.0f, 200.0f, 43.0f);
- self.imageView.frame = CGRectMake(0.0f, 0.0f, 50.0f, 43.0f);
-}
-
-@end
@@ -1,32 +0,0 @@
-//
-// GHMenuViewController.h
-// GHSidebarNav
-//
-// Created by Greg Haines on 1/3/12.
-// Copyright (c) 2012 Greg Haines. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-@class GHRevealViewController;
-
-@interface GHMenuViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
-@private
- GHRevealViewController *_sidebarVC;
- UISearchBar *_searchBar;
- UITableView *_menuTableView;
- NSArray *_headers;
- NSArray *_controllers;
- NSArray *_cellInfos;
-}
-
-- (id)initWithSidebarViewController:(GHRevealViewController *)sidebarVC
- withSearchBar:(UISearchBar *)searchBar
- withHeaders:(NSArray *)headers
- withControllers:(NSArray *)controllers
- withCellInfos:(NSArray *)cellInfos;
-
-- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath
- animated:(BOOL)animated
- scrollPosition:(UITableViewScrollPosition)scrollPosition;
-
-@end
Oops, something went wrong.

0 comments on commit 352b1ea

Please sign in to comment.