Repository navigation
Expand file tree
/
Copy pathHappyScoreViewController.m
More file actions
executable file
·149 lines (132 loc) · 4.48 KB
/
Copy pathHappyScoreViewController.m
File metadata and controls
executable file
·149 lines (132 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//
// HappyScoreViewController.m
// iBeHappy
//
// Created by Jaroslaw Szymczyk on 12/28/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "HappyScoreViewController.h"
@interface HappyScoreViewController ()
@end
@implementation HappyScoreViewController
@synthesize profile;
@synthesize bioVC;
@synthesize homeVC;
@synthesize remVC;
@synthesize challengeVC;
@synthesize helpVC;
@synthesize scoreDetailsLabel;
@synthesize completedLabel;
@synthesize daysDetailsLabel;
@synthesize statsTextview;
- (IBAction)Profile:(id)sender
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
if (nil == bioVC) {
bioVC = [storyboard instantiateViewControllerWithIdentifier:@"505"];
}
// viewDidLoad will be called
//[self presentModalViewController:(UIViewController *)bioVC animated:YES];
[self presentViewController:bioVC animated:YES completion:nil];
self.bioVC = nil;
}
- (IBAction)Home:(id)sender
{
if (nil == homeVC) {
homeVC = [[HappyHomeViewController alloc] initWithNibName:@"HappyHomeViewController"
bundle:nil];
}
homeVC.profile = profile;
// viewDidLoad will be called
//[self presentModalViewController:homeVC animated:YES];
[self presentViewController:homeVC animated:YES completion:nil];
self.homeVC = nil;
}
- (IBAction)Challenge:(id)sender
{
if (nil == challengeVC) {
challengeVC = [[HappyChallengeViewController alloc] initWithNibName:@"HappyChallengeViewController"
bundle:nil];
}
challengeVC.profile = profile;
// viewDidLoad will be called
//[self presentModalViewController:challengeVC animated:YES];
[self presentViewController:challengeVC animated:YES completion:nil];
self.challengeVC = nil;
}
- (IBAction)Reminders:(id)sender
{
if (nil == remVC) {
remVC = [[HappyRemindersViewController alloc] initWithNibName:@"HappyRemindersViewController"
bundle:nil];
}
remVC.profile = profile;
// viewDidLoad will be called
//[self presentModalViewController:remVC animated:YES];
[self presentViewController:remVC animated:YES completion:nil];
self.remVC = nil;
}
- (IBAction)Help:(id)sender
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
if (nil == helpVC) {
helpVC = [storyboard instantiateViewControllerWithIdentifier:@"805"];
}
// viewDidLoad will be called
//[self presentModalViewController:(UIViewController *)helpVC animated:YES];
helpVC.profile = self.profile;
helpVC.fromScreen = @"Score";
[self presentViewController:helpVC animated:YES completion:nil];
self.helpVC = nil;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *statsText;
NSString *profileText;
if (profile != nil)
{
if(profile.numOfCompletedChallenges == 0)
{
//self.statsTextview.text
statsText = [NSString stringWithFormat:@"%@, you haven't completed any challenges! \n", profile.name];
}
else
{
statsText = [NSString stringWithFormat:@"%@, you have completed %d out of %d challenges.You have a score of %d out of a maximum possible score of %d \n", profile.name,profile.numOfCompletedChallenges, profile.numOfViewedChallenges, profile.score, profile.maximumPossibleScore];
}
if (profile != nil)
{
profileText = [profile writeoutProfile];
}
}
else
{
statsText = @"It looks like you don't have any challenges to complete because you haven't created a profile.";
profileText = @"Click START on the home screen to get started!";
}
self.statsTextview.text = [NSString stringWithFormat:@"%@ %@", statsText, profileText];
}
- (void)viewDidUnload
{
[self setCompletedLabel:nil];
[self setScoreDetailsLabel:nil];
[self setDaysDetailsLabel:nil];
[self setStatsTextview:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end