按下UITableView,点击,模仿按钮

时间:2013-07-10 08:44:31

标签: ios uitableview

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

2 个答案:

答案 0 :(得分: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];
} 

// rescale uitableview cell。

-(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];

 }

答案 1 :(得分:0)

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

UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];