Permalink
Browse files

Initial layout for public release

  • Loading branch information...
Xenofex committed Jul 20, 2011
0 parents commit 9dad7b7f718f26e5d0c4ba117a2c87ac9fbded24
Showing with 2,979 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +339 −0 MultiColumnTableView.xcodeproj/project.pbxproj
  3. +7 −0 MultiColumnTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  4. +31 −0 MultiColumnTableView/EWHeaderHighlightLayer.h
  5. +38 −0 MultiColumnTableView/EWHeaderHighlightLayer.m
  6. +158 −0 MultiColumnTableView/EWMultiColumnTableView.h
  7. +847 −0 MultiColumnTableView/EWMultiColumnTableView.m
  8. +39 −0 MultiColumnTableView/EWMultiColumnTableViewBGScrollView.h
  9. +71 −0 MultiColumnTableView/EWMultiColumnTableViewBGScrollView.m
  10. +33 −0 MultiColumnTableView/EWMultiColumnTableViewCell.h
  11. +46 −0 MultiColumnTableView/EWMultiColumnTableViewCell.m
  12. +35 −0 MultiColumnTableView/EWMultiColumnTableViewContentBackgroundView.h
  13. +32 −0 MultiColumnTableView/EWMultiColumnTableViewContentBackgroundView.m
  14. +36 −0 MultiColumnTableView/EWMultiColumnTableViewDefaults.h
  15. +39 −0 MultiColumnTableView/MultiColumnTableView-Info.plist
  16. +14 −0 MultiColumnTableView/MultiColumnTableView-Prefix.pch
  17. +36 −0 MultiColumnTableView/MultiColumnTableViewAppDelegate.h
  18. +90 −0 MultiColumnTableView/MultiColumnTableViewAppDelegate.m
  19. +39 −0 MultiColumnTableView/MultiColumnTableViewViewController.h
  20. +336 −0 MultiColumnTableView/MultiColumnTableViewViewController.m
  21. +33 −0 MultiColumnTableView/UIView+AddLine.h
  22. +54 −0 MultiColumnTableView/UIView+AddLine.m
  23. +2 −0 MultiColumnTableView/en.lproj/InfoPlist.strings
  24. +436 −0 MultiColumnTableView/en.lproj/MainWindow.xib
  25. +150 −0 MultiColumnTableView/en.lproj/MultiColumnTableViewViewController.xib
  26. +32 −0 MultiColumnTableView/main.m
  27. +1 −0 README
@@ -0,0 +1,5 @@
+project.xcuserdata/
+xcuserdata/
+.~
+.*.swp
+.DS_Store

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011 Eli Wang
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+
+#import <Foundation/Foundation.h>
+#import <QuartzCore/QuartzCore.h>
+
+@interface EWHeaderHighlightLayer : CALayer {
+
+}
+
+@end
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Eli Wang
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+
+#import "EWHeaderHighlightLayer.h"
+
+
+@implementation EWHeaderHighlightLayer
+
+- (void)drawInContext:(CGContextRef)ctx
+{
+ CGContextSetRGBStrokeColor(ctx, 0.0f, 1.0f, 0.0f, 1.0f);
+ CGContextMoveToPoint(ctx, 0.0f, 0.0f);
+ CGContextSetLineWidth(ctx, 4.0f);
+ CGContextAddLineToPoint(ctx, self.frame.size.width, self.frame.size.height);
+ CGContextStrokePath(ctx);
+}
+
+@end
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2011 Eli Wang
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+
+#import <Foundation/Foundation.h>
+#import <QuartzCore/QuartzCore.h>
+#import "EWMultiColumnTableViewContentBackgroundView.h"
+#import "EWMultiColumnTableViewDefaults.h"
+#import "EWMultiColumnTableViewBGScrollView.h"
+
+@protocol EWMultiColumnTableViewDataSource;
+
+
+
+@interface EWMultiColumnTableView : UIView<UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate> {
+ BOOL respondsToReuseIdAtIndexPath;
+ BOOL respondsToNumberOfSections;
+
+ BOOL respondsToHeightForCell;
+ BOOL respondsToHeightForHeaderCell;
+ BOOL respondsToLeftHeaderCell;
+ BOOL respondsToWidthForHeaderCell;
+ BOOL respondsToWidthForColumn;
+
+ BOOL respondsToHeightForSectionHeaderCell;
+ BOOL respondsToHeightForHeaderCellInSectionHeader;
+
+ BOOL respondsToSetContentForHeaderCellAtRow;
+ BOOL respondsToHeaderCellForColumn;
+ BOOL respondsToSetContentForHeaderCellAtColumn;
+ BOOL respondsToHeightForTopHeaderCell;
+
+ NSInteger selectedColumn;
+
+ EWMultiColumnTableViewBGScrollView *scrlView;
+ UITableView *headerTblView;
+ EWMultiColumnTableViewContentBackgroundView *tblView;
+
+ // Keep if or not each section is folded. YES for folded, NO for expanded.
+ NSMutableArray *sectionFoldingStatus;
+ NSMutableArray *indexPathTable;
+
+ UIView *tblViewHeader;
+
+ CALayer *highlightColumnLayer;
+}
+
+@property (nonatomic, assign) id<EWMultiColumnTableViewDataSource> dataSource;
+
+@property (nonatomic, assign) CGFloat cellHeight;
+@property (nonatomic, assign) CGFloat cellWidth;
+@property (nonatomic, assign) CGFloat topHeaderHeight;
+@property (nonatomic, assign) CGFloat leftHeaderWidth;
+@property (nonatomic, assign) CGFloat sectionHeaderHeight;
+@property (nonatomic, assign) CGFloat boldSeperatorLineWidth;
+@property (nonatomic, assign) CGFloat normalSeperatorLineWidth;
+
+@property (nonatomic, retain) UIColor *boldSeperatorLineColor;
+@property (nonatomic, retain) UIColor *normalSeperatorLineColor;
+
+@property (nonatomic, retain) UIColor *leftHeaderBackgroundColor;
+@property (nonatomic, retain) UIColor *sectionHeaderBackgroundColor;
+
+@property (nonatomic, retain) UIColor *topHeaderBackgroundColor;
+
+@property (nonatomic, assign) BOOL sectionFoldedByDefault;
+@property (nonatomic, assign) BOOL sectionHeaderEnabled;
+
+- (void)reloadData;
+- (BOOL)sectionIsFolded:(NSInteger)section;
+
+@end
+
+
+
+@protocol EWMultiColumnTableViewDataSource <NSObject>
+
+- (UIView *)tableView:(EWMultiColumnTableView *)tableView cellForIndexPath:(NSIndexPath *)indexPath column:(NSInteger)col;
+- (void)tableView:(EWMultiColumnTableView *)tableView setContentForCell:(UIView *)cell indexPath:(NSIndexPath *)indexPath column:(NSInteger)col;
+- (NSInteger)tableView:(EWMultiColumnTableView *)tableView numberOfRowsInSection:(NSInteger)section;
+- (NSInteger)numberOfColumnsInTableView:(EWMultiColumnTableView *)tableView;
+
+
+@optional
+
+- (CGFloat)tableView:(EWMultiColumnTableView *)tableView heightForCellAtIndexPath:(NSIndexPath *)indexPath column:(NSInteger)column;
+
+- (CGFloat)tableView:(EWMultiColumnTableView *)tableView widthForColumn:(NSInteger)column;
+
+// If not implemented, a default cell id will be given.
+- (NSString *)tableView:(EWMultiColumnTableView *)tableView reuseIdForIndexPath:(NSIndexPath *)multiColIndexPath;
+
+#pragma mark - Header Cell
+#pragma mark height and width
+- (CGFloat)tableView:(EWMultiColumnTableView *)tableView heightForHeaderCellAtIndexPath:(NSIndexPath *)indexPath;
+// Top header row
+- (CGFloat)heightForHeaderCellOfTableView:(EWMultiColumnTableView *)tableView;
+// Left header column
+- (CGFloat)widthForHeaderCellOfTableView:(EWMultiColumnTableView *)tableView;
+
+#pragma mark cell and content
+// Create a new header cell in left
+- (UIView *)tableView:(EWMultiColumnTableView *)tableView headerCellForIndexPath:(NSIndexPath *)indexPath;
+// set content for a resuable header cell
+- (void)tableView:(EWMultiColumnTableView *)tableView setContentForHeaderCell:(UIView *)cell atIndexPath:(NSIndexPath *)multiColIndexPath;
+
+- (UIView *)tableView:(EWMultiColumnTableView *)tableView headerCellForColumn:(NSInteger)col;
+- (void)tableView:(EWMultiColumnTableView *)tableView setContentForHeaderCell:(UIView *)cell atColumn:(NSInteger)col;
+- (UIView *)topleftHeaderCellOfTableView:(EWMultiColumnTableView *)tableView;
+
+
+
+
+#pragma mark - Action callback
+- (void)tableView:(EWMultiColumnTableView *)tableView swapDataOfColumn:(NSInteger)col1 andColumn:(NSInteger)col2;
+
+
+
+
+#pragma mark - Section and section header
+
+- (NSInteger)numberOfSectionsInTableView:(EWMultiColumnTableView *)tableView;
+
+#pragma mark section header normal cell
+// new cell
+- (UIView *)tableView:(EWMultiColumnTableView *)tableView sectionHeaderCellForSection:(NSInteger)section column:(NSInteger)col;
+// set content
+- (void)tableView:(EWMultiColumnTableView *)tableView setContentForSectionHeaderCell:(UIView *)cell section:(NSInteger)section column:(NSInteger)col;
+// height
+- (CGFloat)tableView:(EWMultiColumnTableView *)tableView heightForSectionHeaderCellAtSection:(NSInteger)section column:(NSInteger)col;
+
+#pragma mark table header in section header
+// new cell
+- (UIView *)tableView:(EWMultiColumnTableView *)tableView headerCellInSectionHeaderForSection:(NSInteger)section;
+- (void)tableView:(EWMultiColumnTableView *)tableView setContentForHeaderCellInSectionHeader:(UIView *)cell AtSection:(NSInteger)section;
+// height
+- (CGFloat)tableView:(EWMultiColumnTableView *)tableView heightForHeaderCellInSectionHeaderAtSection:(NSInteger)section;
+
+@end
Oops, something went wrong.

0 comments on commit 9dad7b7

Please sign in to comment.