-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditPlanning.m
executable file
·186 lines (159 loc) · 5.74 KB
/
EditPlanning.m
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//
// EditPlanning.m
// TradeShowInfo
//
// Created by Bright Creek on 5/9/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "EditPlanning.h"
#import "Constants.h"
@implementation EditPlanning
@synthesize headerViewOfYourBiggestGoals,headerViewOfCompaniesToVisit,headerViewOfFieldVisits,headerViewOfSeminarsAndWorkshop,headerViewOfStrategicMeetings,headerViewOfDayPlanner;
-(void)viewDidLoad{
[super viewDidLoad];
self.view.backgroundColor = [Constants backgroundColor];
headerViewOfYourBiggestGoals= [[SectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 40) title:@"Your Biggest Goals" section:0 delegate:self];
headerViewOfCompaniesToVisit = [[SectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 40) title:@"Companies to Visit" section:1 delegate:self];
headerViewOfFieldVisits= [[SectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 40) title:@"Field Visits" section:2 delegate:self];
headerViewOfSeminarsAndWorkshop = [[SectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 40) title:@"Seminars & Workshop" section:3 delegate:self];
headerViewOfStrategicMeetings= [[SectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 40) title:@"Strategic Meetings" section:4 delegate:self];
headerViewOfDayPlanner = [[SectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 40) title:@"Day Planner" section:5 delegate:self];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 6;
}
-(UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section {
if (section==0) {
return headerViewOfYourBiggestGoals;
}
else if(section==1){
return headerViewOfCompaniesToVisit;
}
else if (section==2) {
return headerViewOfFieldVisits;
}
else if(section==3){
return headerViewOfSeminarsAndWorkshop;
}
else if(section==4){
return headerViewOfStrategicMeetings;
}
else if(section==5){
return headerViewOfDayPlanner;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"PlanningCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
return cell;
}
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// CGFloat height=0.0;
//
// if (indexPath.section==0) {
// height=114.0;
// }
// if (indexPath.section==1) {
// height=72.0;
// }
// if (indexPath.section==2){
// height=80.0;
// }
// if (indexPath.section==3){
// height=20.0;
// }
// if (indexPath.section==4){
// height=140.0;
// }
//
// return height;
//}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 44.0;
}
#pragma mark Section header delegate
//-(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionOpened:(NSInteger)sectionOpened{
// NSLog(@"%d opened",sectionOpened);
//// switch (sectionOpened) {
//// case 0:
//// [self insertOrDeleteYourBiggestGoals];
//// break;
//// default:
//// break;
//// }
// [self insertOrDeleteYourBiggestGoals:sectionOpened];
//}
//-(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionClosed:(NSInteger)sectionClosed{
// NSLog(@"%d closed",sectionClosed);
// //[self insertOrDeleteContacts:sectionClosed];
//}
//-(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionPlus:(NSInteger)section{
// NSLog(@"%d plus clicked",section);
//}
-(void)insertOrDeleteYourBiggestGoals:(NSInteger)sectionNumber{
if (sectionNumber==0) {
//if (openFlagOfContacts==NO) {
/*
Create an array containing the index paths of the rows to insert: These correspond to the rows for each quotation in the current section.
*/
//NSInteger countOfRowsToInsert = 2;
NSMutableArray *indexPathsToInsert = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i < 2; i++) {
[indexPathsToInsert addObject:[NSIndexPath indexPathForRow:i inSection:0]];
}
//openFlagOfContacts=YES;
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:UITableViewRowAnimationTop];
[self.tableView endUpdates];
[indexPathsToInsert release];
NSLog(@"table view height %f",self.view.frame.size.height);
// }
// else {
// openFlagOfContacts=NO;
// //NSInteger countOfRowsToDelete = [contactsAndToDos numberOfRowsInSection:sectionClosed];
//
// //if (countOfRowsToDelete > 0)
// {
// NSMutableArray *indexPathsToDelete = [[NSMutableArray alloc] init];
// for (NSInteger i = 0; i < countOfContacts; i++) {
// [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:sectionNumber]];
// }
// [self.tableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:UITableViewRowAnimationTop];
// [indexPathsToDelete release];
// }
// NSLog(@"table view height %f",self.view.frame.size.height);
// }
}
}
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// // Return the number of rows in the section.
// if(section==0)
//// if (openFlagOfContacts) {
//// return 4;
//// }
// return 4;
// else {
// return 0;
// }
// if(section==2)
// return 0;
// return 1;
//}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end