Skip to content

Commit c4031c0

Browse files
committed
Made it easier to override KalViewController's title.
Prior to this commit, KalViewController used to clobber its 'title' property inherited from UIViewController in its loadView method. I changed this so that now it only sets a default title if the title property is nil. I modified both of the example apps to set the KalViewController's title explicitly. This makes it easier for clients of KalViewController to customize its behavior without resorting to subclassing or the even more drastic measure of modifying KalViewController's implementation. This closes issue #17 on GitHub.
1 parent db35b7e commit c4031c0

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Examples/Holiday/Classes/HolidayAppDelegate.m

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application
2222
* instead of -[KalViewController init].
2323
*/
2424
kal = [[KalViewController alloc] init];
25+
kal.title = @"Holidays";
2526

2627
/*
2728
* Kal Configuration

Examples/NativeCal/Classes/NativeCalAppDelegate.m

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application
2424
* instead of -[KalViewController init].
2525
*/
2626
kal = [[KalViewController alloc] init];
27+
kal.title = @"NativeCal";
2728

2829
/*
2930
* Kal Configuration

src/KalViewController.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ - (NSDate *)selectedDate
171171

172172
- (void)loadView
173173
{
174-
self.title = @"Calendar";
175-
174+
if (!self.title)
175+
self.title = @"Calendar";
176176
KalView *kalView = [[KalView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] delegate:self logic:logic];
177177
self.view = kalView;
178178
tableView = kalView.tableView;

0 commit comments

Comments
 (0)