uitableviewrowaction

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

Changing the UITableViewCell swipe action title

╄→尐↘猪︶ㄣ 提交于 2020-01-17 03:34:56
问题 I have a row action button titled "Activate". When I press it, I want the title to change to "Deactivate". I was unable to change the title in the handler function. Also, "Activate" and "Deactivate" should have different functions. func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? { let account = accountTypes[indexPath.section].accounts[indexPath.row] let delete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title:

Working with images in tableView:editActionsForRowAt:

末鹿安然 提交于 2020-01-06 05:30:14
问题 Here is some trouble I am having working with a UITableView, more precisely using an image in tableView:editActionsForRowAt: Below follows my relevant code. It may be useful to say that the images I am using here are all square 70x70. func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { var patternImg:UIImage? let upBtn = UITableViewRowAction(style: .normal, title: "") { action, index in print("upBtn button tapped") } patternImg =

Segue from editActionsForRowAtIndexPath

烈酒焚心 提交于 2019-12-24 09:49:53
问题 I'm making a little banking type app, for instructional purposes. All transactions are stored as Core Data entities, fetched and sorted using Magical Record helper methods. The transactions are displayed in a UITableView , fed by a fetchedObjects array. I want to be able to use editActionsForRowAtIndexPath like so: The first action segues to another uiviewController , the second and third to a UIPopoverPresentationController . The fourth button deletes the transaction. EDIT Here's the code to

Table view cell background goes white when deleting a cell - iOS

别来无恙 提交于 2019-12-23 18:30:51
问题 I have an iOS app with a UITableView , I have noticed that the cell background colour flashes white when the user selects the Delete button. In the editActionsForRowAtIndexPath method, I have created two cell buttons: Edit and Delete . The first button's style is set to UITableViewRowActionStyleNormal . however the second button's style is set to UITableViewRowActionStyleDestructive - I have noticed that this issue only occurs when then style is set to destructive. Does anyone know why this

UITableViewRowAction with image instead of title

时间秒杀一切 提交于 2019-12-21 12:17:50
问题 I'd like to make a cell swipe action like mail app. I set UIImage to backgroundColor of row action. action.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"remove"]]; But i get my image repeated side-by-side on the background. like this. enter image description here Is the image size problem? Could tell me how to fix it,or an other way to do it ? 回答1: Yes, this is an image size problem. Even I had a similar requirement and faced the same problem. In this case when you

Custom UITableViewRowAction button

可紊 提交于 2019-12-19 10:24:56
问题 I want to set top and bottom constraint for uitableviewrowaction button Here's my code - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ }]; deleteAction.backgroundColor = [UIColor redColor]; return @[deleteAction]; } Like this I've added delete

Custom UITableViewRowAction button

依然范特西╮ 提交于 2019-12-19 10:24:04
问题 I want to set top and bottom constraint for uitableviewrowaction button Here's my code - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ }]; deleteAction.backgroundColor = [UIColor redColor]; return @[deleteAction]; } Like this I've added delete