Is there a recommended image size for UIContextualAction icons?

uicontextualaction image not showing
uicontextualaction image and title
uicontextualaction image color
uicontextualaction custom view
uitableviewrowaction image
uicontextualaction text color
editactionsforrowat
uicontextualaction image tint color

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.

I use 30 by 30. You can render your image down to that size in code easily enough.

    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))
    }

Programming IOS 11: Dive Deep Into Views, View Controllers, and , The title can be nil, because you might set the UIContextualAction's image instead. with a trash-can icon, along with a blue Mark button; the user can swipe left to completion(true) } d.image = UIGraphicsImageRenderer(size:​CGSize(30  Image: Helen Tran 3. Properly sized. Icons should be good targets for users. Leaving too little space for icons on mobiles is one of the most common mistakes among designers. When you design for touch, make sure that the icons are sized large enough to be easily touched in a finger. The recommended target size for touchscreen objects is 7

There is no recommendation here, since a standard size does not make much sense given the variety of UITableViewCell sizes – it's depending on the concrete app and device it's running on. I recommend you resize the icon on runtime – don't forget to leave a bit of room to breath (vertical margin = 8px or so).

Programming iOS 12: Dive Deep into Views, View Controllers, and , Instead of disabling swipe-to-delete, you might choose to extend it, introducing addi‐tional because you might set the UIContextualAction's image instead. button with a trash-can icon, along with a blue Mark button; the user can swipe left to see completion(true) } d.image = UIGraphicsImageRenderer(size:​CGSize(30  The icons should be in .ico file format. The full set should includes following icon sizes: Icons for Windows 8 (Metro Design) Application icons 30х30, 50x50, 150x150. App Bar icons 26х26. By the way, we make the largest free icon pack of Windows 8 icons. Either download all icons in a single ZIP file or search icons by tags and download only

we can take size 30 by 30 , is the standard size , we can take more than 30 pixel , depending on the size of the screen.

Type of image that is support

func tableView(_ tableView: UITableView,
                   trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
    {
        // Write action code for the trash
        let TrashAction = UIContextualAction(style: .normal, title:  "Delete", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
            print("Update action ...")
                    success(true)
        })
       TrashAction.backgroundColor = .white
       TrashAction.image =  UIImage(imagename: "dustbin")           
       return UISwipeActionsConfiguration(actions: [TrashAction])
    }

Programming iOS 13: Dive Deep into Views, View Controllers, and , The title can be nil, because you might set the UIContextualAction's image instead. with a trash-can icon, along with a blue Mark button; the user can swipe left to with:.fade) } }) completion(true) } d.image = UIGraphicsImageRenderer(size:  There is sometimes a little confusion over the different sizes required to create a Windows 7 Application Icon file. This is in some way brought about by the flexibility of the ICO format and its ability to ‘contain’ many image sizes and colour depths but is also not helped by Microsoft’s own quite poor documentation on Windows Icon Size

UISwipeActionsConfiguration/UIContextualAction with icon AND text , Is there a recommended image size for UIContextualAction icons? 1 · iOS TableView swipe UIContextualAction can not get a right image · 4 · UIContextualAction  Android Icon Sizes Made Simple (4.1) This article has now been superseded by the latest Lollipop 6.0 Android Icon Size Guide . Please click on the image below for the latest information.

Universal solution for UITableViewRowAction and UIContextualAction, Since the width of the UITableViewRowAction is calculated by the size of the text, But if we want to make the text under the icon, this method will not work for us. The idea is to manually draw an image with the desired location of elements  The cover photo or header image is the big hitter on most of these networks. In contrast to the profile images, which are typically square, the various social sites have widely varying sizes for their cover images. Here are a few tips to remember: You’ll probably want to go with a .png file, instead of a .jpg.

Table Swipe Actions, The new style swipe actions added in iOS 11 and used by Apple in Mail comment: "Favorite") let action = UIContextualAction(style: .normal, title: the image but following the advice for custom icons is probably a good idea. Icons can be rendered either through JSX components, or as a font character. The icon code will register the font-face definition only when a given icon from a subset is referenced. What we're trying to optimize here is download size. We define a map of icon codes which map to a font-face.

Comments
  • Why not use the images in the Mail app as a guide? Also the appropriate size for the icon will vary based on the size of your table's rows.
  • Maybe you are able to use destructive style and measure size by debug view hierarchy.
  • @Lumialxk good idea, but I haven't found a way to get a UIContextualAction with destructive style to show a default icon.
  • @nathan I think that's the best we can do. Fwiw, Mail.app is using icons with 28pt height. Fixed height, too: the title label disappears if you reduce the cell height (e.g. by setting message preview lines to zero), but the icon is always visible and fixed size regardless of cell height.
  • But perhaps what Apple really wants you to do nowadays is supply a vector-based image, which will be resized automatically
  • Agreed that vector images are easier when possible.
  • I couldn't get a vector image to resize in the UIContextualAction. I experimented with a 100x100 vector image (PDF), added it to my xcassets with Resizing checked to "Preserve Vector Data" and set Scales to "Single Scale" and it displayed as 100x100. Maybe I missed a setting?