UITableViewRowActionでは、アクションの幅は、タイトルを変更してスペースを入れることで操作できます。使用するスペースが増えれば、その行であなたの行動が占めるスペースが広がります。iOS11でUIContextualActionの幅を指定する方法はありますか?
新しいUIContextualActionでは、タイトルにスペースを入れることは何もしません。 OSは、アクションがどれくらいのスペースを占めるかを正確に決定します。私は5つの異なるアクションオプションを表示する必要があり、小さなデバイスでは、私はもはや適合できません5.誰もビュー内のこれらの各領域のサイズを制御する方法を知っていますか?
func setupAction(_ indexVar: Int) -> UIContextualAction {
let editAction = UIContextualAction(style: .normal, title: " ", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
//do something
success(true)
})
editAction.image = UIImage(named: "TestImage")
editAction.backgroundColor = .red
return editAction
}