To prevent the picture How to restore the real color I now place the image are white
- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0))
{
UIContextualAction *deleteRowAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:nil handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL))
{
NSLog(@"------------------>%@",sourceView);
completionHandler (YES);
}];
deleteRowAction.image = [UIImage imageNamed:@"heart"];
UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
return config;
return nil;
}
RSSReaderMaker solution work with small updates Swift 5:
class ImageWithoutRender: UIImage {
override func withRenderingMode(_ renderingMode: UIImage.RenderingMode) -> UIImage {
return self
}
}
And in trailingSwipeActionsConfigurationForRowAt
or leadingSwipeActionsConfigurationForRowAt
Use:
if let cgImageX = UIImage(named: "x_blue_big")?.cgImage {
action.image = ImageWithoutRender(cgImage: cgImageX, scale: UIScreen.main.nativeScale, orientation: .up)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With