-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |