uiswipeactionsconfiguration

Set custom font for UITableView swipe action (UIContextualAction)

余生颓废 提交于 2020-05-28 04:42:19
问题 How do you set a custom font for the title in UIContextualAction ? I have tried UIAppearance but without any luck... Cheers! :) 回答1: I have found a way to do this by using the image property instead of the title... Standard font (Remove/Rename) Custom font (Remove/Rename) To create an image of a label I have this extension: extension UIImage { /// This method creates an image of a view convenience init?(view: UIView) { // Based on https://stackoverflow.com/a/41288197/1118398 let renderer =

UITableView: swiping RowAction cancels the selected rows

泪湿孤枕 提交于 2020-02-25 13:08:48
问题 I can see this behavior in both deprecated UITableViewRowAction class and UISwipeActionsConfiguration class: If you have allowsMultipleSelection property set to true and, let's say, you have 3 rows selected: When you start swiping any row in the table for a RowAction the previously selected rows -- all 3 of them -- become unhighlighted, and the property indexPathsForSelectedRows drops to nil. Does this behavior make sense? Is there any 'deselecting' callback (because I'm displaying the number

tableView:editActionsForRowAt: on right-swipe?

纵然是瞬间 提交于 2019-12-24 20:52:38
问题 As I was using tableView:editActionsForRowAt: to provide some useful functionalities in an iOS app. func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { print(#function) .... useful code ..... } I got to the point where some other API similar to the one above, but fired on a right swipe, rather than left swipe like tableView:editActionsForRowAt: would have been useful. Say something like: func tableView(_ tableView: UITableView,

Add strikethrough to tableview row with a swipe

…衆ロ難τιáo~ 提交于 2019-12-24 06:17:14
问题 I've got a problem to strikethrough over the row text while swiping (E.G. left). I'm using the tableview method leadingSwipeActionsConfigurationForRowAt , but I can't find the solution to strikethrough text while swiping. As of now, the "swiped" row actually gets deleted. What I'm looking to do: Code: override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { let complete = completeAction(at: indexPath)

Why is the leading swipe action also duplicated as a trailing action?

橙三吉。 提交于 2019-12-24 00:17:37
问题 I have implemented a leading swipe action ('Delete') on my tableView which for a reason I can't figure out is also appearing as a trailing swipe action. See code below: func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { let delete1 = deleteAction(at: indexPath) return UISwipeActionsConfiguration(actions: [delete1]) } func deleteAction(at indexPath: IndexPath) -> UIContextualAction { let action =

iOS TableView swipe UIContextualAction can not get a right image

你。 提交于 2019-12-13 03:34:32
问题 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

Trailing swipe actions not dismissing

白昼怎懂夜的黑 提交于 2019-12-07 16:45:32
问题 I have trailing swipe actions configured in my UITableView. The actions work correctly, but when an action removes the cell from the table, the swipe actions remain over the row that replaces the removed row. So it looks like the new current row is swiped. And I think the swipe actions may actually transfer their attachment to that new row, I can't tell. Is there some dismiss function I don't realize I need to call? 回答1: For your contextual action, don't forget to set your completion handler

Image in TableViewCell swipe action

[亡魂溺海] 提交于 2019-11-28 14:30:10
I have a swipe action to 'complete' a task in my to-do list app. This is the image I have set: However when the cell is swiped, the image looks like this: Is there a way to make the background transparent/white and the image to have the green circle like the image above? If there is not, is there a way to make the green background 'wrap' to the purple of the cell so there is no whitespace? Thanks! In the second image, the green is the UIContextualAction's backgroundColor and the white is the tintColor . The image is treated as a template image — that is, its colors are ignored, and instead it

Image in TableViewCell swipe action

旧城冷巷雨未停 提交于 2019-11-27 08:37:20
问题 I have a swipe action to 'complete' a task in my to-do list app. This is the image I have set: However when the cell is swiped, the image looks like this: Is there a way to make the background transparent/white and the image to have the green circle like the image above? If there is not, is there a way to make the green background 'wrap' to the purple of the cell so there is no whitespace? Thanks! 回答1: In the second image, the green is the UIContextualAction's backgroundColor and the white is