0

私は現在、iOS 7 および iOS 8 用のアプリに取り組んでおり、Xcode 6 ビルド 7 を Swift でコーディングしています。カスタムセルを含むテーブルビューを取得したビューコントローラーの1つで、テーブルビュープロパティの編集を「true」に設定しても何も起こらず、削除ボタンが表示されませんが、デフォルトのセルを使用すると私の代わりにそれは動作します。

私はすべての必要な方法を使用しました

func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
    return true
}

func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
    if (editingStyle == UITableViewCellEditingStyle.Delete) {
        // handle delete (by removing the data from your array and updating the tableview)
    }
}

func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
    return .Delete
}

誰も同じ問題を抱えていませんか?

ありがとう!!

4

1 に答える 1

4

わかりました、すべての解決策が常に目の前にあった後、問題は、セルのlayoutSubviewsメソッドで私がやっていたことでしたが、super.layoutSubviewsを呼び出すのを完全に忘れていました。これを行ったとき、すべてが機能しました完全。

于 2014-09-21T16:40:05.590 に答える