![](/img/trans.png)
[英]UITableVIew swipe trailingSwipeActionsConfigurationForRowAt not working
[英]UITableView trailingSwipeActionsConfigurationForRowAt image and title
在iOS 11中,我們在UITableViewrailingSwipeActionsConfigurationForRowAt中提供了一個功能來獲取滑動事件。 但是,當我嘗試減小行的高度時,文本消失,僅保留圖像。
有什么辦法可以我倆都保留嗎? 我的像元高度應為60.0,我需要同時顯示圖像和標題。 它適用於84.0。 @ 2x的圖像尺寸為30x30,@ 3x的圖像尺寸為60x60
下面是我的代碼
let contextItem = UIContextualAction(style: .normal, title: "Rename") { (contextualAction, view, boolValue) in
//do something
}
contextItem.image = UIImage(named: "deleteIcon")
let swipeActions = UISwipeActionsConfiguration(actions: [contextItem])
似乎iOS 11中存在一個錯誤,除非表格視圖單元格高度為91點,否則它不會同時顯示圖像和標題。 有關更多信息,請訪問https://forums.developer.apple.com/thread/86009
UIContextualAction支持文本或圖像。 通過使用setImage:屬性設置圖像,基本上可以在創建對象時刪除標題。 如果同時需要文本和圖像,則需要創建帶有嵌入式文本的圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.