Skip to content

Commit

Permalink
Added tables
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhess committed Jul 1, 2011
1 parent f020537 commit e0454df
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Helium.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
/* Begin PBXBuildFile section */
781BEB0A13BE1386002F9389 /* HEShakeWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 781BEB0813BE1386002F9389 /* HEShakeWindow.h */; };
781BEB0B13BE1386002F9389 /* HEShakeWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 781BEB0913BE1386002F9389 /* HEShakeWindow.m */; };
781BEB1813BE2062002F9389 /* HETable.h in Headers */ = {isa = PBXBuildFile; fileRef = 781BEB1613BE2062002F9389 /* HETable.h */; };
781BEB1913BE2062002F9389 /* HETable.m in Sources */ = {isa = PBXBuildFile; fileRef = 781BEB1713BE2062002F9389 /* HETable.m */; };
781BEB1C13BE2123002F9389 /* HECell.h in Headers */ = {isa = PBXBuildFile; fileRef = 781BEB1A13BE2123002F9389 /* HECell.h */; };
781BEB1D13BE2123002F9389 /* HECell.m in Sources */ = {isa = PBXBuildFile; fileRef = 781BEB1B13BE2123002F9389 /* HECell.m */; };
7837177613B3E29300C0600C /* HENavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7837177413B3E29000C0600C /* HENavigation.h */; };
7837177713B3E29300C0600C /* HENavigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 7837177513B3E29200C0600C /* HENavigation.m */; };
7837177B13B3E39F00C0600C /* HETabs.h in Headers */ = {isa = PBXBuildFile; fileRef = 7837177913B3E39D00C0600C /* HETabs.h */; };
Expand Down Expand Up @@ -79,6 +83,10 @@
/* Begin PBXFileReference section */
781BEB0813BE1386002F9389 /* HEShakeWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HEShakeWindow.h; sourceTree = "<group>"; };
781BEB0913BE1386002F9389 /* HEShakeWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HEShakeWindow.m; sourceTree = "<group>"; };
781BEB1613BE2062002F9389 /* HETable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HETable.h; sourceTree = "<group>"; };
781BEB1713BE2062002F9389 /* HETable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HETable.m; sourceTree = "<group>"; };
781BEB1A13BE2123002F9389 /* HECell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HECell.h; sourceTree = "<group>"; };
781BEB1B13BE2123002F9389 /* HECell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HECell.m; sourceTree = "<group>"; };
7837177413B3E29000C0600C /* HENavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HENavigation.h; sourceTree = "<group>"; };
7837177513B3E29200C0600C /* HENavigation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HENavigation.m; sourceTree = "<group>"; };
7837177913B3E39D00C0600C /* HETabs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HETabs.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -258,6 +266,10 @@
785E641013BB96BA00FB3C03 /* HEScroll.m */,
781BEB0813BE1386002F9389 /* HEShakeWindow.h */,
781BEB0913BE1386002F9389 /* HEShakeWindow.m */,
781BEB1613BE2062002F9389 /* HETable.h */,
781BEB1713BE2062002F9389 /* HETable.m */,
781BEB1A13BE2123002F9389 /* HECell.h */,
781BEB1B13BE2123002F9389 /* HECell.m */,
);
path = Helium;
sourceTree = "<group>";
Expand Down Expand Up @@ -324,6 +336,8 @@
785E641113BB96BA00FB3C03 /* HEScroll.h in Headers */,
785E642113BBCE8300FB3C03 /* HEAdapter.h in Headers */,
781BEB0A13BE1386002F9389 /* HEShakeWindow.h in Headers */,
781BEB1813BE2062002F9389 /* HETable.h in Headers */,
781BEB1C13BE2123002F9389 /* HECell.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -444,6 +458,8 @@
785E641213BB96BA00FB3C03 /* HEScroll.m in Sources */,
785E642213BBCE8300FB3C03 /* HEAdapter.m in Sources */,
781BEB0B13BE1386002F9389 /* HEShakeWindow.m in Sources */,
781BEB1913BE2062002F9389 /* HETable.m in Sources */,
781BEB1D13BE2123002F9389 /* HECell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
14 changes: 14 additions & 0 deletions Helium/HECell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// HECell.h
// Helium
//
// Created by Sean Hess on 7/1/11.
// Copyright 2011 I.TV. All rights reserved.
//

#import "HEBase.h"

@interface HECell : HEBase
@property (nonatomic, retain) NSString * text;
@property (nonatomic, retain) NSString * click;
@end
20 changes: 20 additions & 0 deletions Helium/HECell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// HECell.m
// Helium
//
// Created by Sean Hess on 7/1/11.
// Copyright 2011 I.TV. All rights reserved.
//

#import "HECell.h"

@implementation HECell
@synthesize text, click;

- (void) dealloc {
[text release];
[click release];
[super dealloc];
}

@end
14 changes: 14 additions & 0 deletions Helium/HETable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// HETable.h
// Helium
//
// Created by Sean Hess on 7/1/11.
// Copyright 2011 I.TV. All rights reserved.
//

#import "HEView.h"
#import <UIKit/UIKit.h>

@interface HETable : HEView <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, retain) NSNumber * rowHeight;
@end
79 changes: 79 additions & 0 deletions Helium/HETable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// HETable.m
// Helium
//
// Created by Sean Hess on 7/1/11.
// Copyright 2011 I.TV. All rights reserved.
//

#import "HETable.h"
#import "HECell.h"

@interface HETable ()
@property (nonatomic, retain) UITableView * tableView;
@end

@implementation HETable
@synthesize tableView, rowHeight;

- (void) dealloc {
[tableView release];
[rowHeight release];
[super dealloc];
}

- (void) didInitialize {
self.tableView = [[UITableView new] autorelease];

if (self.rowHeight)
self.tableView.rowHeight = [self.rowHeight floatValue];

self.tableView.delegate = self;
self.tableView.dataSource = self;
[super didInitialize];
}

- (UIView *)view {
return self.tableView;
}



// TABLE VIEW DATASOURCE
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.children.count;
}

- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
//cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//cell.selectionStyle = UITableViewCellSelectionStyleGray;
}

HECell * child = [self.children objectAtIndex:indexPath.row];
cell.textLabel.text = child.text;
return cell;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

// TABLE VIEW DELEGATE
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
HECell * child = [self.children objectAtIndex:indexPath.row];
if (child && child.click)
[[NSNotificationCenter defaultCenter] postNotificationName:@"click" object:self userInfo:[NSDictionary dictionaryWithObject:child.click forKey:@"url"]];
}

// NOT SUPPORT! Use rowHeight instead
//- (CGFloat)tableView:(UITableView *)table heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// return [super tableView:table heightForRowAtIndexPath:indexPath];
//}


@end

0 comments on commit e0454df

Please sign in to comment.