私はこのxcodeが初めてです。UITableViewCell
をダブルクリックすると、詳細を表示しようとしています。だから私は拡大していUITableViewCell
ます。を展開している間UITableViewCell
、セルを展開する前に表示されていたラベルと画像が位置を変更しています。つまり、それらは の展開された部分に移動していUITableViewCell
ます。私に提案してください。
前もって感謝します...
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (selectedRow && indexPath.row == tappedRow && tapCount == 2)
{
return 200;
}
return 62;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(tapCount == 1 && tappedRow == indexPath.row){
tapCount = tapCount + 1;
annotate.hidden =YES;
selectedRow = [tableView indexPathForSelectedRow];
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]withRowAnimation:UITableViewRowAnimationNone];
annotate.hidden = NO;
[UIView commitAnimations];
}
else if (tapCount == 0){
tapCount = tapCount +1;
tappedRow = indexPath.row;
}
else if (tapCount ==2 && tappedRow == indexPath.row){
tapCount = 0;
annotate.hidden = YES;
[tableView setRowHeight:62];
[tableView reloadData];
[annotate release];
}
else if (tappedRow != indexPath.row){
tapCount = 1;
tappedRow = indexPath.row;
annotate.hidden = YES;
[annotate release];
}
}
- (UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"ChooseAPlayer"];
UILabel *lblName = (UILabel *)[cell viewWithTag:101];
[lblName setText:[inputPlayersList objectAtIndex:[indexPath row]]];
UILabel *Teams = (UILabel *)[cell viewWithTag:103];
[Teams setText:[inputPlayersTeams objectAtIndex:[indexPath row]]];
UILabel *AwayTeams = (UILabel *)[cell viewWithTag:104];
[AwayTeams setText:[inputPlayersAwayteams objectAtIndex:[indexPath row]]];
UILabel *PlayersPrice = (UILabel *)[cell viewWithTag:105];
[PlayersPrice setText:[inputPlayersPrice objectAtIndex:[indexPath row]]];
annotate.hidden = YES;
if ( indexPath.row == tappedRow && tapCount == 2)
{
annotate.hidden = YES;
annotate.tag = indexPath.row;
annotate = [[UIView alloc] init];
annotate.frame = CGRectMake(0, 62, 320, 138);
annotate.backgroundColor = [UIColor greenColor];
[cell.contentView addSubview:annotate];
}
UIImage *image = [UIImage imageNamed:@"Select_white.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(44.0, 44.0, image.size.width, image.size.height);
button.frame = frame;
[button setBackgroundImage:image forState:UIControlStateNormal];
[button addTarget:self action:@selector(accessoryButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
button.backgroundColor = [UIColor clearColor];
cell.accessoryView = button;
return cell;
}