177 |
177 |
178 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { |
178 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { |
179 return 45.0; |
179 return 45.0; |
180 } |
180 } |
181 |
181 |
182 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { |
182 -(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section { |
183 CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30); |
183 CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 70/100, 30); |
184 NSString *text = (section == 0) ? NSLocalizedString(@"Playing Teams",@"") : NSLocalizedString(@"Available Teams",@""); |
184 NSString *text = (section == 0) ? NSLocalizedString(@"Playing Teams",@"") : NSLocalizedString(@"Available Teams",@""); |
185 UILabel *theLabel = [[UILabel alloc] initWithFrame:frame andTitle:text]; |
185 UILabel *theLabel = [[UILabel alloc] initWithFrame:frame andTitle:text]; |
186 theLabel.center = CGPointMake(self.view.frame.size.width/2, 20); |
186 theLabel.center = CGPointMake(self.view.frame.size.width/2, 20); |
187 |
187 theLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
188 UIView *theView = [[[UIView alloc] init] autorelease]; |
188 |
|
189 UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, 30)]; |
|
190 theView.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
189 [theView addSubview:theLabel]; |
191 [theView addSubview:theLabel]; |
190 [theLabel release]; |
192 [theLabel release]; |
191 return theView; |
193 return [theView autorelease]; |
192 } |
194 } |
193 |
195 |
194 -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { |
196 -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { |
195 return IS_IPAD() ? 40 : 20; |
197 return IS_IPAD() ? 40 : 20; |
196 } |
198 } |
197 |
199 |
198 -(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section { |
200 -(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section { |
199 NSInteger height = IS_IPAD() ? 40 : 20; |
201 NSInteger height = IS_IPAD() ? 40 : 20; |
200 UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)]; |
202 UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)]; |
201 footer.backgroundColor = [UIColor clearColor]; |
203 footer.backgroundColor = [UIColor clearColor]; |
|
204 footer.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
202 |
205 |
203 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width*80/100, height)]; |
206 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width*80/100, height)]; |
204 label.center = CGPointMake(aTableView.frame.size.width/2, height/2); |
207 label.center = CGPointMake(aTableView.frame.size.width/2, height/2); |
205 label.textAlignment = UITextAlignmentCenter; |
208 label.textAlignment = UITextAlignmentCenter; |
206 label.font = [UIFont italicSystemFontOfSize:12]; |
209 label.font = [UIFont italicSystemFontOfSize:12]; |
207 label.textColor = [UIColor whiteColor]; |
210 label.textColor = [UIColor whiteColor]; |
208 label.numberOfLines = 2; |
211 label.numberOfLines = 2; |
|
212 label.backgroundColor = [UIColor clearColor]; |
|
213 label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; |
|
214 |
209 if (section == 0) |
215 if (section == 0) |
210 label.text = NSLocalizedString(@"Tap to add hogs or change color, touch and hold to remove a team.",@""); |
216 label.text = NSLocalizedString(@"Tap to add hogs or change color, touch and hold to remove a team.",@""); |
211 else |
217 else |
212 label.text = NSLocalizedString(@"The robot badge indicates an AI-controlled team.",@""); |
218 label.text = NSLocalizedString(@"The robot badge indicates an AI-controlled team.",@""); |
213 |
219 |
214 label.backgroundColor = [UIColor clearColor]; |
|
215 [footer addSubview:label]; |
220 [footer addSubview:label]; |
216 [label release]; |
221 [label release]; |
217 return [footer autorelease]; |
222 return [footer autorelease]; |
218 } |
223 } |
219 |
224 |