tableViewでピークとポップが発生している間に、previewingContext.sourceRect
を丸くするにはどうすればよいですか?現時点でForce Touch TableViewセルが丸みを帯びたピックとポップ - iOS Swift
:テーブルビューのセルに
フォースタッチのようなプレビューデリゲートを設定し
:
previewingContext.sourecRect = tableView.rectForRow(時:indexPath)
を
私はすでにセルのを設定しようとしました& cell.layer.maskToBounds = true
cellForRowAtIndexPath
であるが、プレビューソートレットは依然として完全な長方形である。
関連コード:テーブルビューのセルに以下の画像に青いボックスに触れるだけの力が選択さsourcerectである
UIVIewControllerPreviewingDelegate
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
if tableView.isEditing == false {
guard let indexPath = tableView.indexPathForRow(at: location) else {
print("Nil Cell Found: \(location)")
return nil }
guard let detailVC = storyboard?.instantiateViewController(withIdentifier: "view") as? ViewController else { return nil }
previewingContext.sourceRect = tableView.rectForRow(at: indexPath)
return detailVC
} else {
return nil
}
}
テーブルビューCellForRowAtIndexPath現在
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? CustomCell else { fatalError("No cell with identifier: cell") }
cell.titleLabel.text = "temp"
// cell.inputView?.layer.cornerRadius = 16.0
// cell.inputView?.layer.masksToBounds = true
// cell.contentView.layer.cornerRadius = 16.0
// cell.contentView.layer.masksToBounds = true
cell.layer.cornerRadius = 16.0
cell.layer.borderWidth = 2
cell.layer.borderColor = UIColor.orange.cgColor
cell.layer.masksToBounds = true
return cell
}
}
私はオレンジ色の丸い矩形(1つのセルの)をソースの矩形にしたい。
'layer.masksToBounds = true'も設定しましたか? – raidfive
はい、あなたの現在のコードなしで – Jerland2
を反映する編集された質問私は誰もそれほど多くを助けることができると思います。関連するコードスニペットを投稿してください – muescha