天道酬勤,学无止境

uicontextualaction

iOS TableView 滑动 UIContextualAction 无法获得正确的图像(iOS TableView swipe UIContextualAction can not get a right image)

问题 我想在单元格的左滑动中设置一个图像,有代码,但它不起作用。 - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath { if (@available (iOS 11, *)) { UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { if (self.dataArray.count > indexPath.row) { [self.dataArray removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:@

2021-10-21 10:55:48    分类:技术分享    ios   uitableview   uicontextualaction   uiswipeactionsconfiguration

UIContextualAction 图标是否有推荐的图像大小?(Is there a recommended image size for UIContextualAction icons?)

问题 iOS 11 中的新功能 UIContextualAction 提供了一种在 UITableView 单元格上实现滑动操作的便捷方法,带有标题和/或图像图标。 我在 UIContextualAction 使用的图像的人机界面指南中没有发现任何提及。 是否存在定义此图标图像的标准尺寸或其他设计指南的信息? 我试图通过测试一些图像大小来解决这个问题,看看 iOS 是否会将它缩放到一致的大小,但它似乎只是显示你给它的任何东西,没有缩放或裁剪,所以没有提供任何线索。 回答1 我使用 30 x 30。你可以很容易地在代码中将图像渲染到那个大小。 let d = UIContextualAction(style: .destructive, title: nil) { action, view, completion in // ... whatever ... completion(true) } d.image = UIGraphicsImageRenderer(size: CGSize(width: 30, height: 30)).image { _ in UIImage(named: "trash")?.draw(in: CGRect(x: 0, y: 0, width: 30, height: 30)) } 回答2 这里没有推荐

2021-10-20 10:13:24    分类:技术分享    ios   uitableview   uicontextualaction

iOS TableView swipe UIContextualAction can not get a right image

I want to set a image in the left swipe of cell, there is the code, but It doesn't work. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath { if (@available (iOS 11, *)) { UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { if (self.dataArray.count > indexPath.row) { [self.dataArray

2021-09-07 22:06:42    分类:问答    ios   uitableview   uicontextualaction   uiswipeactionsconfiguration

Is there a recommended image size for UIContextualAction icons?

New in iOS 11, UIContextualAction provides a convenient way to implement swipe actions on UITableView cells, with a title and/or image icon. I haven't found any mention in the Human Interface Guidelines of the image used by UIContextualAction. Does any information exist that defines a standard size or other design guidance for this icon image? I tried to figure this out by testing a few image sizes to see if iOS would scale it to a consistent size, but it seems to just display whatever you give it with no scaling or cropping, so that didn't provide any clues.

2021-06-22 10:59:27    分类:问答    ios   uitableview   uicontextualaction

Set custom font for UITableView swipe action (UIContextualAction)

How do you set a custom font for the title in UIContextualAction? I have tried UIAppearance but without any luck... Cheers! :)

2021-04-20 08:59:47    分类:问答    ios   uitableview   uitableviewrowaction   uicontextualaction   uiswipeactionsconfiguration