Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 36543d2141acd7f309741113a264e45979088a8b @kishikawakatsumi committed Mar 8, 2010
@@ -0,0 +1 @@
+*.pbxproj -crlf -diff -merge
@@ -0,0 +1,10 @@
+build
+.DS_Store
+*.o
+*.ob
+*.pbxuser
+*.tmproj
+*.mode1*
+*.build
+*~.nib
+
@@ -0,0 +1,15 @@
+//
+// FirstViewController.h
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright Kishikawa Katsumi 2010. All rights reserved.
+//
+
+#import "FlipCardView.h"
+
+@interface FirstViewController : UIViewController {
+ FlipCardView *thumbnailView;
+}
+
+@end
@@ -0,0 +1,88 @@
+//
+// FirstViewController.m
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright Kishikawa Katsumi 2010. All rights reserved.
+//
+
+#import "FirstViewController.h"
+#import "SecondViewController.h"
+
+@implementation FirstViewController
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+- (void)loadView {
+ UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 414.0f)];
+ contentView.backgroundColor = [UIColor grayColor];
+ self.view = contentView;
+ [contentView release];
+
+ thumbnailView = [[FlipCardView alloc] initWithFrame:contentView.frame];
+ thumbnailView.delegate = self;
+ thumbnailView.dataSource = self;
+ [contentView addSubview:thumbnailView];
+ [thumbnailView release];
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+}
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+}
+
+#pragma mark FlipCardViewDataSource Methods
+
+- (NSUInteger)flipCardViewNumberOfRows:(FlipCardView *)flipCardView {
+ return 8;
+}
+
+- (NSUInteger)flipCardViewNumberOfColumns:(FlipCardView *)flipCardView {
+ return 5;
+}
+
+- (UIView *)flipCardView:(FlipCardView *)flipCardView thumbnailViewForRow:(NSUInteger)row forColumn:(NSUInteger)column {
+ UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 106.0f, 106.0f)];
+ label.backgroundColor = [UIColor whiteColor];
+ label.text = [NSString stringWithFormat:@"%d", row * [self flipCardViewNumberOfColumns:flipCardView] + column];
+ label.textAlignment = UITextAlignmentCenter;
+ label.font = [UIFont boldSystemFontOfSize:24.0f];
+ return [label autorelease];
+}
+
+#pragma mark FlipCardViewDelegate Methods
+
+- (CGFloat)flipCardView:(FlipCardView *)flipCardView heightForRow:(NSUInteger)row {
+ return 106.0f;
+}
+
+- (CGFloat)flipCardView:(FlipCardView *)flipCardView widthForColumn:(NSUInteger)column {
+ return 106.0f;
+}
+
+- (void)flipCardView:(FlipCardView *)flipCardView didSelectThumbnailForRow:(NSUInteger)row forColumn:(NSUInteger)column {
+ SecondViewController *controller = [[SecondViewController alloc] init];
+
+ UINavigationBar *navigationBar = self.navigationController.navigationBar;
+ navigationBar.delegate = self;
+
+ controller.navigationBar = navigationBar;
+ controller.previousViewController = self;
+
+ [flipCardView pushViewController:controller];
+ [controller release];
+
+ [navigationBar pushNavigationItem:controller.navigationItem animated:YES];
+}
+
+- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {
+ [thumbnailView popViewController];
+ return YES;
+}
+
+@end
@@ -0,0 +1,18 @@
+//
+// FlipCardNavigationViewAppDelegate.h
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright Kishikawa Katsumi 2010. All rights reserved.
+//
+
+@interface FlipCardNavigationViewAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ UINavigationController *navigationController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
+
+@end
+
@@ -0,0 +1,35 @@
+//
+// FlipCardNavigationViewAppDelegate.m
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright Kishikawa Katsumi 2010. All rights reserved.
+//
+
+#import "FlipCardNavigationViewAppDelegate.h"
+#import "FirstViewController.h"
+
+@implementation FlipCardNavigationViewAppDelegate
+
+@synthesize window;
+@synthesize navigationController;
+
+
+#pragma mark -
+#pragma mark Application lifecycle
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+ [window addSubview:[navigationController view]];
+ [window makeKeyAndVisible];
+}
+
+#pragma mark -
+#pragma mark Memory management
+
+- (void)dealloc {
+ [navigationController release];
+ [window release];
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,19 @@
+//
+// FlipCardThumbnailButton.h
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright 2010 Kishikawa Katsumi. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface FlipCardThumbnailButton : UIButton {
+ NSUInteger row;
+ NSUInteger column;
+}
+
+@property (nonatomic) NSUInteger row;
+@property (nonatomic) NSUInteger column;
+
+@end
@@ -0,0 +1,16 @@
+//
+// FlipCardThumbnailButton.m
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright 2010 Kishikawa Katsumi. All rights reserved.
+//
+
+#import "FlipCardThumbnailButton.h"
+
+@implementation FlipCardThumbnailButton
+
+@synthesize row;
+@synthesize column;
+
+@end
@@ -0,0 +1,61 @@
+//
+// FlipCardView.h
+// FlipCardNavigationView
+//
+// Created by Kishikawa Katsumi on 10/03/08.
+// Copyright 2010 Kishikawa Katsumi. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class FlipCardThumbnailButton;
+
+@interface FlipCardView : UIView<UIScrollViewDelegate> {
+ UIScrollView *thumbnailView;
+ BOOL initialized;
+
+ id delegate;
+ id dataSource;
+ NSUInteger numberOfViews;
+ NSUInteger numberOfRows;
+ NSUInteger numberOfColumns;
+ struct {
+ unsigned int dataSourceNumberOfRows:1;
+ unsigned int dataSourceNumberOfColumns:1;
+ unsigned int dataSourceThumbnailView:1;
+ unsigned int dataSourceFullView:1;
+ unsigned int delegateHeightForRow:1;
+ unsigned int delegateWidthForColumn:1;
+ unsigned int delegateDidSelectThumbnail:1;
+ } flags;
+
+ UIViewController *nextViewController;
+ FlipCardThumbnailButton *lastSelected;
+ CGRect thumbFrame;
+}
+
+@property (nonatomic, assign) id delegate;
+@property (nonatomic, assign) id dataSource;
+@property (nonatomic) UIEdgeInsets contentInset;
+@property (nonatomic) UIEdgeInsets scrollIndicatorInsets;
+
+@property (nonatomic, retain) UIViewController *nextViewController;
+
+- (void)pushViewController:(UIViewController *)controller;
+- (void)popViewController;
+
+@end
+
+@protocol FlipCardViewDataSource
+- (NSUInteger)flipCardViewNumberOfRows:(FlipCardView *)flipCardView;
+- (NSUInteger)flipCardViewNumberOfColumns:(FlipCardView *)flipCardView;
+- (UIView *)flipCardView:(FlipCardView *)flipCardView thumbnailViewForRow:(NSUInteger)row forColumn:(NSUInteger)column;
+- (UIView *)flipCardView:(FlipCardView *)flipCardView fullViewForRow:(NSUInteger)row forColumn:(NSUInteger)column;
+@end
+
+@protocol FlipCardViewDelegate
+- (CGFloat)flipCardView:(FlipCardView *)flipCardView heightForRow:(NSUInteger)row;
+- (CGFloat)flipCardView:(FlipCardView *)flipCardView widthForColumn:(NSUInteger)column;
+@optional
+- (void)flipCardView:(FlipCardView *)flipCardView didSelectThumbnailForRow:(NSUInteger)row forColumn:(NSUInteger)column;
+@end
Oops, something went wrong.

0 comments on commit 36543d2

Please sign in to comment.