diff options
Diffstat (limited to 'Classes')
| -rw-r--r-- | Classes/ChatMessagesDataSource.h | 16 | ||||
| -rw-r--r-- | Classes/ChatMessagesDataSource.m | 33 | ||||
| -rw-r--r-- | Classes/ChatViewController.h | 3 | ||||
| -rw-r--r-- | Classes/ChatViewController.m | 19 | 
4 files changed, 53 insertions, 18 deletions
| diff --git a/Classes/ChatMessagesDataSource.h b/Classes/ChatMessagesDataSource.h new file mode 100644 index 0000000..b259b9b --- /dev/null +++ b/Classes/ChatMessagesDataSource.h @@ -0,0 +1,16 @@ +// +//  ChatMessagesDataSource.h +//  NearMe +// +//  Created by TW on 9/29/12. +//  Copyright 2012 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> + + +@interface ChatMessagesDataSource : NSObject <UITableViewDataSource> { + +} + +@end diff --git a/Classes/ChatMessagesDataSource.m b/Classes/ChatMessagesDataSource.m new file mode 100644 index 0000000..f3a60cb --- /dev/null +++ b/Classes/ChatMessagesDataSource.m @@ -0,0 +1,33 @@ +// +//  ChatMessagesDataSource.m +//  NearMe +// +//  Created by TW on 9/29/12. +//  Copyright 2012 __MyCompanyName__. All rights reserved. +// + +#import "ChatMessagesDataSource.h" + + +@implementation ChatMessagesDataSource + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +	return 5; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { +	static NSString *CellIdentifier = @"ChatCell"; +	  +	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; +	if (cell == nil) { +		cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; +	} +	  +	// Set up the cell... +	NSString *cellValue = @"test"; +	cell.textLabel.text = cellValue; +	  +	return cell; +} + +@end diff --git a/Classes/ChatViewController.h b/Classes/ChatViewController.h index ee52715..c6c517c 100644 --- a/Classes/ChatViewController.h +++ b/Classes/ChatViewController.h @@ -8,9 +8,10 @@  #import <UIKit/UIKit.h>  #import "HPGrowingTextView.h" +#import "ChatMessagesDataSource.h" -@interface ChatViewController : UIViewController <HPGrowingTextViewDelegate, UITableViewDelegate, UITableViewDataSource> { +@interface ChatViewController : UIViewController <HPGrowingTextViewDelegate, UITableViewDelegate> {  	UITableView *chatTableView;  	UIView *containerView;      HPGrowingTextView *textView; diff --git a/Classes/ChatViewController.m b/Classes/ChatViewController.m index aee79c8..b0bd903 100644 --- a/Classes/ChatViewController.m +++ b/Classes/ChatViewController.m @@ -39,6 +39,8 @@      self.view.backgroundColor = [UIColor colorWithRed:219.0f/255.0f green:226.0f/255.0f blue:237.0f/255.0f alpha:1];  	chatTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; +	ChatMessagesDataSource *dataSource = [[ChatMessagesDataSource alloc] init]; +	[chatTableView setDataSource:dataSource];  	[self.view addSubview:chatTableView];      containerView = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40, 320, 40)]; @@ -188,23 +190,6 @@  # pragma mark UITableViewDelegate methods -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { -	return 5; -} -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { -	static NSString *CellIdentifier = @"ChatCell"; -	  -	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; -	if (cell == nil) { -		cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; -	} -	  -	// Set up the cell... -	NSString *cellValue = @"test"; -	cell.textLabel.text = cellValue; -	  -	return cell; -}  @end | 
