85 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
85 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
86 static NSString *CellIdentifier0 = @"Cell0"; |
86 static NSString *CellIdentifier0 = @"Cell0"; |
87 static NSString *CellIdentifier1 = @"Cell1"; |
87 static NSString *CellIdentifier1 = @"Cell1"; |
88 NSInteger section = [indexPath section]; |
88 NSInteger section = [indexPath section]; |
89 UITableViewCell *cell; |
89 UITableViewCell *cell; |
90 |
90 |
91 if (section == 0) { |
91 if (section == 0) { |
92 cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; |
92 cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; |
93 if (cell == nil) { |
93 if (cell == nil) { |
94 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; |
94 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; |
95 |
95 |
96 UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)]; |
96 UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)]; |
97 numberButton.tag = NUMBERBUTTON_TAG; |
97 numberButton.tag = NUMBERBUTTON_TAG; |
98 [cell addSubview:numberButton]; |
98 [cell addSubview:numberButton]; |
99 [numberButton release]; |
99 [numberButton release]; |
100 |
100 |
101 SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+7, 5, 36, 36)]; |
101 SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+7, 5, 36, 36)]; |
102 squareButton.tag = SQUAREBUTTON_TAG; |
102 squareButton.tag = SQUAREBUTTON_TAG; |
103 [cell addSubview:squareButton]; |
103 [cell addSubview:squareButton]; |
104 [squareButton release]; |
104 [squareButton release]; |
105 |
105 |
106 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+7+36+7, 10, 250, 25)]; |
106 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+7+36+7, 10, 250, 25)]; |
107 label.textAlignment = UITextAlignmentLeft; |
107 label.textAlignment = UITextAlignmentLeft; |
108 label.backgroundColor = [UIColor clearColor]; |
108 label.backgroundColor = [UIColor clearColor]; |
109 label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize] + 2]; |
109 label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize] + 2]; |
110 label.tag = LABEL_TAG; |
110 label.tag = LABEL_TAG; |
111 [cell.contentView addSubview:label]; |
111 [cell.contentView addSubview:label]; |
112 [label release]; |
112 [label release]; |
113 } |
113 } |
114 |
114 |
115 NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]]; |
115 NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]]; |
116 |
116 |
117 UILabel *cellLabel = (UILabel *)[cell viewWithTag:LABEL_TAG]; |
117 UILabel *cellLabel = (UILabel *)[cell viewWithTag:LABEL_TAG]; |
118 cellLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension]; |
118 cellLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension]; |
119 |
119 |
120 HogButtonView *numberButton = (HogButtonView *)[cell viewWithTag:NUMBERBUTTON_TAG]; |
120 HogButtonView *numberButton = (HogButtonView *)[cell viewWithTag:NUMBERBUTTON_TAG]; |
121 [numberButton drawManyHogs:[[selectedRow objectForKey:@"number"] intValue]]; |
121 [numberButton drawManyHogs:[[selectedRow objectForKey:@"number"] intValue]]; |
122 numberButton.ownerDictionary = selectedRow; |
122 numberButton.ownerDictionary = selectedRow; |
123 |
123 |
124 SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG]; |
124 SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG]; |
125 [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]]; |
125 [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]]; |
126 squareButton.ownerDictionary = selectedRow; |
126 squareButton.ownerDictionary = selectedRow; |
127 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
127 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
128 cellLabel.textColor = [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xCB/255 blue:0 alpha:1]; |
128 cellLabel.textColor = [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xCB/255 blue:0 alpha:1]; |
129 } |
129 } |
130 } else { |
130 } else { |
131 cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
131 cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
132 if (cell == nil) |
132 if (cell == nil) |
133 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; |
133 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; |
134 |
134 |
135 cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; |
135 cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; |
136 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
136 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
137 cell.textLabel.textColor = [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xCB/255 blue:0 alpha:1 ]; |
137 cell.textLabel.textColor = [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xCB/255 blue:0 alpha:1 ]; |
138 } |
138 } |
139 } |
139 } |
140 |
140 |
141 return cell; |
141 return cell; |
142 } |
142 } |
143 |
143 |
144 |
144 |
145 #pragma mark - |
145 #pragma mark - |