aboutsummaryrefslogtreecommitdiffstats
path: root/Classes
diff options
context:
space:
mode:
authorTeddy Wing2012-09-29 16:21:31 -0400
committerTeddy Wing2012-09-29 16:21:31 -0400
commitaaa15ec5beeb3df296b7b0fa6d693f04fd52170b (patch)
treef15922fef950c3a3d6ae2504512a37ab4628eb81 /Classes
parent033f9053ada0a7f2a9ef7e6652746cd3cbb8f300 (diff)
downloadbabblr-iOS-aaa15ec5beeb3df296b7b0fa6d693f04fd52170b.tar.bz2
Moved tableView datasource to separate class.
Diffstat (limited to 'Classes')
-rw-r--r--Classes/ChatMessagesDataSource.h16
-rw-r--r--Classes/ChatMessagesDataSource.m33
-rw-r--r--Classes/ChatViewController.h3
-rw-r--r--Classes/ChatViewController.m19
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