28 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
28 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
29 return rotationManager(interfaceOrientation); |
29 return rotationManager(interfaceOrientation); |
30 } |
30 } |
31 |
31 |
32 -(void) viewDidLoad { |
32 -(void) viewDidLoad { |
33 if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) |
33 [self.tableView setBackgroundColorForAnyTable:[UIColor clearColor]]; |
34 self.tableView.backgroundView = nil; |
|
35 |
34 |
36 NSString *imgName; |
35 NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png"; |
37 if (IS_IPAD()) |
36 UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName]; |
38 imgName = @"mediumBackground~ipad.png"; |
37 UIImageView *background = [[UIImageView alloc] initWithImage:img]; |
39 else |
38 [img release]; |
40 imgName = @"smallerBackground~iphone.png"; |
39 background.frame = self.view.frame; |
41 |
40 background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
42 if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) { |
41 [self.view insertSubview:background atIndex:0]; |
43 UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:imgName]; |
42 [background release]; |
44 UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; |
|
45 [backgroundImage release]; |
|
46 [self.tableView setBackgroundView:background]; |
|
47 [background release]; |
|
48 } else |
|
49 self.view.backgroundColor = [UIColor blackColor]; |
|
50 |
43 |
51 self.tableView.separatorColor = [UIColor darkYellowColor]; |
44 self.tableView.separatorColor = [UIColor darkYellowColor]; |
52 self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
45 self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
53 |
46 |
54 [super viewDidLoad]; |
47 [super viewDidLoad]; |
123 } |
116 } |
124 |
117 |
125 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { |
118 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { |
126 if (section == 0) { |
119 if (section == 0) { |
127 UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 160)]; |
120 UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 160)]; |
|
121 header.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
|
122 |
128 UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"]; |
123 UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"]; |
129 UIImageView *imgView = [[UIImageView alloc] initWithImage:img]; |
124 UIImageView *imgView = [[UIImageView alloc] initWithImage:img]; |
130 [img release]; |
125 [img release]; |
131 imgView.center = CGPointMake(self.tableView.frame.size.height/2, 160/2); |
126 imgView.center = CGPointMake(self.tableView.frame.size.width/2, 160/2); |
|
127 imgView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
132 [header addSubview:imgView]; |
128 [header addSubview:imgView]; |
133 [imgView release]; |
129 [imgView release]; |
134 |
130 |
135 return [header autorelease]; |
131 return [header autorelease]; |
136 } else |
132 } else |
141 return self.tableView.rowHeight + 30; |
137 return self.tableView.rowHeight + 30; |
142 } |
138 } |
143 |
139 |
144 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { |
140 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { |
145 if (section == 2) { |
141 if (section == 2) { |
146 |
142 UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width * 70 / 100, self.tableView.rowHeight)]; |
147 UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height * 70 / 100, self.tableView.rowHeight)]; |
|
148 footer.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
143 footer.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
149 |
144 |
150 UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.height * 70 / 100, self.tableView.rowHeight)]; |
145 UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.width * 70 / 100, self.tableView.rowHeight)]; |
151 button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
146 button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
152 [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal]; |
147 [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal]; |
153 [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
148 [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
154 [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; |
149 [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; |
155 |
150 |