Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

KalViewController now exposes its UITableView as a property.

This allows you to provide your own UITableViewDelegate or to override the configuration of the UITableView (row height, separator color, etc.)
  • Loading branch information...
commit 6489b7985482704f1751c6179efd11848b543954 1 parent 68c0a08
@klazuka authored
View
9 Kal/KalDataSource.h
@@ -15,7 +15,7 @@
* The protocol is a mix of asynchronous and synchronous methods.
* The primary asynchronous method, presentingDatesFrom:to:delegate:,
* allows implementations to retrieve data from the network or disk
- * without causing a delay when the user slides between months.
+ * without causing the UI to hang when the user slides between months.
*
* --- Asynchronous part of the protocol ---
*
@@ -25,7 +25,10 @@
* switches to a different month. Your code should respond by
* loading application data for the specified range of dates and sending the
* loadedDataSource: callback message as soon as the appplication data
- * is ready and available in memory.
+ * is ready and available in memory. If the lookup of your application
+ * data is expensive, you should perform the lookup using an asynchronous
+ * API (like NSURLConnection for web service resources) or in a background
+ * thread.
*
* If the application data for the new month is already in-memory,
* you must still issue the callback.
@@ -43,7 +46,7 @@
* data.
*
* If this message is received but the application data is not yet
- * ready, your code should return an empty NSArray.
+ * ready, your code should immediately return an empty NSArray.
*
* loadItemsFromDate:toDate:
*
View
3  Kal/KalViewController.h
@@ -27,9 +27,10 @@
}
@property (nonatomic, readonly) KalView *calendarView;
+@property (nonatomic, readonly) UITableView *tableView;
- (id)initWithDataSource:(id<KalDataSource>)source; // designated initializer
-- (void)showAndSelectToday;
+- (void)showAndSelectToday; // Updates the state of the calendar to display today's month and selects the tile for today's date.
@end
View
11 Kal/KalViewController.m
@@ -60,6 +60,17 @@ - (void)fetchDataForCurrentMonth
[dataSource presentingDatesFrom:logic.fromDate to:logic.toDate delegate:self];
}
+- (UITableView *)tableView
+{
+ UITableView *table = [[self calendarView] tableView];
+ if (!table) {
+ [self loadView];
+ table = [[self calendarView] tableView];
+ }
+
+ return table;
+}
+
// -----------------------------------------
#pragma mark KalViewDelegate protocol
Please sign in to comment.
Something went wrong with that request. Please try again.