0

我正在使用 UITableview,我希望单元格看起来像一个按下的按钮,我该怎么做?

4

2 回答 2

1

尝试这个 ,

// 获取选定的 tableview 单元格并在单元格上执行一些动画。我正在使用放大和缩小动画

 #pragma mark Table View Delgate method
- (void)tableView:(UITableView *)tbView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  CustomTableViewCellForTradeList *cell=(CustomTableViewCellForTradeList *)[tbl_TradeList cellForRowAtIndexPath:indexPath ];
    cell.transform = CGAffineTransformMakeScale(0.85,0.85);
    [self performSelector:@selector(NavigateToTradeBuySellAfterScaling:) withObject:indexPath afterDelay:0.1];
} 

//重新缩放uitableview单元格。

-(void)NavigateToTradeBuySellAfterScaling:(NSIndexPath *)indexPath
{
CustomTableViewCellForTradeList *cell=(CustomTableViewCellForTradeList *)[tbl_TradeList cellForRowAtIndexPath:indexPath ];
cell.transform = CGAffineTransformMakeScale(1.0,1.0);
[self performSelector:@selector(NavigateToTradeBuySellAfterScaling1:) withObject:indexPath afterDelay:0.1];
}

//导航到其他视图控制器

 -(void)NavigateToTradeBuySellAfterScaling1:(NSIndexPath *)indexPath
{
 TradeBuySellViewController*  tradeBuySellController    = [[TradeBuySellViewController alloc] initWithNibName:@"TradeBuySellViewController" bundle:nil :entity];
[self.navigationController pushViewController:tradeBuySellController animated:YES];

 }
于 2013-07-10T08:56:14.507 回答
0

您可以尝试更改UITableViewCell单击时的背景视图。您可以使用此方法获取单击的单元格。

UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
于 2013-07-10T08:55:48.793 回答