diff options
| -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 | ||||
| -rwxr-xr-x | NearMe.xcodeproj/project.pbxproj | 6 | 
5 files changed, 59 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 diff --git a/NearMe.xcodeproj/project.pbxproj b/NearMe.xcodeproj/project.pbxproj index c9a22c2..83c3ec1 100755 --- a/NearMe.xcodeproj/project.pbxproj +++ b/NearMe.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@  		D134D80B161781F50098794B /* MessageEntrySendButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D134D803161781F50098794B /* MessageEntrySendButton@2x.png */; };  		D134D80C161781F50098794B /* MessageEntrySendButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = D134D804161781F50098794B /* MessageEntrySendButtonPressed.png */; };  		D134D80D161781F50098794B /* MessageEntrySendButtonPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D134D805161781F50098794B /* MessageEntrySendButtonPressed@2x.png */; }; +		D134D89116178EF10098794B /* ChatMessagesDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = D134D89016178EF10098794B /* ChatMessagesDataSource.m */; };  /* End PBXBuildFile section */  /* Begin PBXFileReference section */ @@ -63,6 +64,8 @@  		D134D803161781F50098794B /* MessageEntrySendButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MessageEntrySendButton@2x.png"; sourceTree = "<group>"; };  		D134D804161781F50098794B /* MessageEntrySendButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MessageEntrySendButtonPressed.png; sourceTree = "<group>"; };  		D134D805161781F50098794B /* MessageEntrySendButtonPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MessageEntrySendButtonPressed@2x.png"; sourceTree = "<group>"; }; +		D134D88F16178EF10098794B /* ChatMessagesDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChatMessagesDataSource.h; path = Classes/ChatMessagesDataSource.h; sourceTree = "<group>"; }; +		D134D89016178EF10098794B /* ChatMessagesDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ChatMessagesDataSource.m; path = Classes/ChatMessagesDataSource.m; sourceTree = "<group>"; };  /* End PBXFileReference section */  /* Begin PBXFrameworksBuildPhase section */ @@ -153,6 +156,8 @@  		D134D6E8161768700098794B /* Classes */ = {  			isa = PBXGroup;  			children = ( +				D134D88F16178EF10098794B /* ChatMessagesDataSource.h */, +				D134D89016178EF10098794B /* ChatMessagesDataSource.m */,  				D134D774161778790098794B /* ChatViewController.h */,  				D134D775161778790098794B /* ChatViewController.m */,  				D134D6E21617685C0098794B /* RootViewController.h */, @@ -268,6 +273,7 @@  				D134D777161778790098794B /* ChatViewController.m in Sources */,  				D134D7D4161780390098794B /* HPGrowingTextView.m in Sources */,  				D134D7D5161780390098794B /* HPTextViewInternal.m in Sources */, +				D134D89116178EF10098794B /* ChatMessagesDataSource.m in Sources */,  			);  			runOnlyForDeploymentPostprocessing = 0;  		}; | 
