2012-03-06 8 views

答えて

0

いつでも画像で自分のボタンを作ることができます。タイプCustomを選択し、ボタンの画像を選択します。最高のユーザーエクスペリエンスを得るには、強調表示された画像を選択することを忘れないでください

0

あなたは、ボタンを削除するにtableViewを参照している場合は、ここでのトリックは、あなたがスワイプ操作を行う際に、以下のように、以下のデリゲートがcellForRowAtIndexPathコードに続いて

- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    indexForEdit=indexPath.row; //Store the row index 
    edit=1; 
    [tableView reloadData]; 
} 

、最初に呼び出されます、

です

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
//Create a custom cell 
if((indexPath.row==indexForEdit)&&(edit==1)) 
    { 
     edit=0; 
     UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
     //Set frame 
     [customButton setTitle:@"Delete" forState:normal]; 
     [customButton setBackgroundColor:[UIColor grayColor]]; 
     [cell.contentView addSubview:customButton]; 
    } 
} 
関連する問題