2012-01-17 43 views
0

在我的iPhone應用程序中,我有一個UITableView。 我想兩個按鈕,而它的刷卡上一個細胞出現,我想他們是這樣的:刷卡後UITableViewCell上的自定義按鈕

  1. 的按鈕將是我自己的自定義按鈕

  2. 的按鈕會出現一個像蘋果提供的普通刪除按鈕一樣的小動畫。

有沒有辦法做到這一點?

感謝

+0

你做多遠到現在?郵編。 – Emon 2012-01-18 07:20:24

+0

您需要閱讀指導原則。這可能會導致應用拒絕,因爲您違反了標準。 – iamsult 2012-01-17 10:38:48

+0

你能否說出一定的觀點會違反? – vikingosegundo 2012-01-17 10:41:48

回答

2

我認爲boilerplate.com是全力幫助你的問題,它包含不同類型的電池技術。與按鈕刷卡也包括http://iosboilerplate.com/

+0

什麼「例子」? – Ross 2013-01-24 12:56:11

+0

@Ross對不起,錯誤的詞使用,我已經更新了我的答案 – Hiren 2013-01-24 13:31:47

0

我做

 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

UISwipeGestureRecognizer *swipeLeftRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)]; 
[swipeLeftRight setDirection:(UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft)]; 
[cell addGestureRecognizer:swipeLeftRight]; 

-(void)handleGesture : (UIGestureRecognizer *)gec 

{

if (gec.state == UIGestureRecognizerStateEnded) { 
    UITableViewCell *cell = (UITableViewCell *)gec.view; 
    UIImageView *imgDelete = [[UIImageView alloc]initWithFrame:CGRectMake(cell.frame.size.width-40, 15, 35, 35)]; 
    UITapGestureRecognizer *deleteCell = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(deleteC)]; 
    [imgDelete addGestureRecognizer:deleteCell]; 
    imgDelete.image = [UIImage imageNamed:@"delete.png"]; 
    imgDelete.userInteractionEnabled = YES; 
    [cell bringSubviewToFront:imgDelete]; 

    [UIView animateWithDuration:0.5 
        animations:^(void){ 
      [cell addSubview:imgDelete]; 
}completion:nil];} 

}