2012-01-17 3 views
0

私のiPhoneアプリケーションでは、私はUITableViewを持っています。 私はそれがスワイプている間二つのボタンがセルに表示したい、と私は彼らが次のようになりたい:私自身のカスタムボタンスワイプ後のUITableViewCellのカスタムボタン

  1. ボタンはなりますが表示されます

  2. ボタンリンゴの通常の削除ボタンのような小さなアニメーションが用意されています。

私はそれを行う方法がありますか?

おかげ

+0

で行うました。 – Emon

+0

ガイドラインを守る必要があります。標準に違反しているため、アプリの拒否が発生する可能性があります。 – iamsult

+0

あなたは特定のポイントに名前をつけることができますそれは違反ですか? – vikingosegundo

答えて

2

は、私はそれは、セル技術の異なる種類が含まれている、boilerplate.comはあなたの問題を助けるために最善だと思います。ボタンとスワイプもhttp://iosboilerplate.com/

+0

"例"とは何ですか? – Ross

+0

@Ross間違った単語を使用して申し訳ありませんが、私は自分の答えを更新しました – Hiren

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

}