Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit e64fab2445e8b4b5a6deb28a24d245178593b618 Aleksey Novicov committed Nov 4, 2010
Binary file not shown.
@@ -0,0 +1,22 @@
+//
+// EasyTableAppDelegate.h
+// EasyTable
+//
+// Created by Aleksey Novicov on 6/5/10.
+// Copyright Yodel Code LLC 2010. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class EasyTableViewController;
+
+@interface EasyTableAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ EasyTableViewController *viewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet EasyTableViewController *viewController;
+
+@end
+
@@ -0,0 +1,71 @@
+//
+// EasyTableAppDelegate.m
+// EasyTable
+//
+// Created by Aleksey Novicov on 6/5/10.
+// Copyright Yodel Code LLC 2010. All rights reserved.
+//
+
+#import "EasyTableAppDelegate.h"
+#import "EasyTableViewController.h"
+
+@implementation EasyTableAppDelegate
+
+@synthesize window;
+@synthesize viewController;
+
+
+#pragma mark -
+#pragma mark Application lifecycle
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+
+ // Override point for customization after app launch.
+ [window addSubview:viewController.view];
+ [window makeKeyAndVisible];
+
+ 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)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.
+ See also applicationDidEnterBackground:.
+ */
+}
+
+
+#pragma mark -
+#pragma mark Memory management
+
+- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
+ /*
+ Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
+ */
+}
+
+
+- (void)dealloc {
+ [viewController release];
+ [window release];
+ [super dealloc];
+}
+
+
+@end
@@ -0,0 +1,83 @@
+//
+// EasyTableView.h
+// EasyTableView
+//
+// Created by Aleksey Novicov on 5/30/10.
+// Copyright 2010 Yodel Code LLC. All rights reserved.
+//
+//
+/* ===========================================================================
+
+ NOTES: EasyTableView addresses two concerns. The first is the ability to have
+ a table view that only partially fills the screen. Normally one would use
+ UITableViewController but that requires table views that fill the whole
+ screen. EasyTableView addresses this problem by acting as the controller
+ for the embedded table view, and exposing table view functionality
+ with it's own delegate methods.
+
+ The second concern addressed by EasyTableView is horizontal table views.
+ Table views were initially designed to be vertical only. EasyTableView
+ solves this problem by rotating the table view, and provides the same
+ interface as creating a vertical EasyTableView.
+
+ Now you can create simple partial screen table views, either vertically
+ or horizontally, with the same interface!
+
+ KNOWN LIMITATIONS:
+
+ This implementation currently only supports one section. The view relies
+ on three reserved view tags, 800 - 802.
+
+ A horizontal EasyTableView will correctly auto-resize it's overall length only.
+ A horizontal EasyTableView will NOT necessarily correctly auto-resize it's height.
+*/
+
+#import <UIKit/UIKit.h>
+
+#define TABLEVIEW_TAG 800
+#define ROTATED_CELL_VIEW_TAG 801
+#define CELL_CONTENT_TAG 802
+
+typedef enum {
+ EasyTableViewOrientationVertical,
+ EasyTableViewOrientationHorizontal
+} EasyTableViewOrientation;
+
+@class EasyTableView;
+
+@protocol EasyTableViewDelegate <NSObject>
+- (UIView *)easyTableView:(EasyTableView *)easyTableView viewForRect:(CGRect)rect;
+- (void)easyTableView:(EasyTableView *)easyTableView setDataForView:(UIView *)view forIndex:(NSUInteger)index;
+@optional
+- (void)easyTableView:(EasyTableView *)easyTableView scrolledToOffset:(CGPoint)contentOffset;
+- (void)easyTableView:(EasyTableView *)easyTableView selectedView:(UIView *)selectedView atIndex:(NSUInteger)index deselectedView:(UIView *)deselectedView;
+- (NSUInteger)numberOfCellsForEasyTableView:(EasyTableView *)view;
+@end
+
+
+@interface EasyTableView : UIView <UITableViewDelegate, UITableViewDataSource> {
+ id<EasyTableViewDelegate> delegate;
+ NSIndexPath *_selectedIndexPath;
+ UIColor *cellBackgroundColor;
+ CGFloat _cellWidthOrHeight;
+ NSUInteger _numItems;
+ EasyTableViewOrientation _orientation;
+}
+
+@property (nonatomic, assign) id<EasyTableViewDelegate> delegate;
+@property (nonatomic, readonly) UITableView *tableView;
+@property (nonatomic, readonly) NSArray *visibleViews;
+@property (nonatomic, retain) NSIndexPath *selectedIndexPath;
+@property (nonatomic, retain) UIColor *cellBackgroundColor;
+@property (nonatomic, readonly) EasyTableViewOrientation orientation;
+@property (nonatomic, assign) CGPoint contentOffset;
+@property (nonatomic, assign) NSUInteger numberOfCells;
+
+- (id)initWithFrame:(CGRect)frame numberOfColumns:(NSUInteger)numCells ofWidth:(CGFloat)cellWidth;
+- (id)initWithFrame:(CGRect)frame numberOfRows:(NSUInteger)numCells ofHeight:(CGFloat)cellHeight;
+- (void)selectCellAtIndex:(NSUInteger)index animated:(BOOL)animated;
+- (void)setContentOffset:(CGPoint)offset animated:(BOOL)animated;
+- (UIView *)viewAtIndex:(NSUInteger)index;
+- (CGPoint)offsetForView:(UIView *)cell;
+
+@end
Oops, something went wrong. Retry.

0 comments on commit e64fab2

Please sign in to comment.