3D Touch shortcuts - Color Icon - ios

I know how to develop 3D touch shortcuts with customized icon (grayscale) but my question is is there any possiblility to put colored image as a shortcut icon? I have tried a colored image with
UIApplicationShortcutIcon *logoIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:#"field_valid"]
...but it won't appear. With a grayscale icon, it is working fine.

Sure you can but only with contact images.
See UIApplicationShortcutIcon:
init(contact: CNContact)
Creates a Home screen quick action icon
from the picture for a contact if available, or else creates a
monogram from the contact name.
Source: https://developer.apple.com/documentation/uikit/uiapplicationshortcuticon

According to iOS Human Interface Guidelines, this is not permitted.
From the Home Screen Actions section:
Don't use an emoji in place of an icon. Emojis don't align properly with right-aligned text. Also, emojis are full color, whereas quick action icons are monochromatic.

Related

How do I change the color of the push notification icon in flutter? [duplicate]

I tried making the small icon exactly 16x16, gray-scaled, nothing but gray and white (the gray color being hex value 616161), to create a silhouette of my application icon.
Yet no matter what it just shows up as a white/gray square in the notifications. What am I doing wrong?
(My min api is 21, assuming it is relevant)
Follow this link
First let’s understand the Android documentation which is as follows
“Update or remove assets that involve color. The system ignores all
non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.”
Now this is easy to miss and I have seen many apps that are live in the app store with thousands of users who haven’t followed the mentioned guidelines.
So let me explain in detail how you can convert your notification icon to an Android friendly one with a few clicks.
In your favourite image editor open up your icon file. Convert all parts of the image that you don’t want to show to transparent pixels. All colors and non transparent pixels are displayed in white. Let us go through an example.
EDITED: Thanks #Andrey Patseiko for the tool
For notification you have to use different icons for different versions of android:
Notification notification = new Notification.Builder(context)
.setAutoCancel(true)
.setContentTitle("My notification")
.setContentText("Look, white in Lollipop, else color!")
.setSmallIcon(getNotificationIcon())
.build();
return notification;
Get notification icon on the basis of version
private int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
}
Along with new features and capabilities, Android 5.0 includes a variety of system changes and API behavior changes. See the notification behavior changes.
Notifications are drawn with dark text atop white (or very light)
backgrounds to match the new material design widgets. Make sure that
all your notifications look right with the new color scheme. If your
notifications look wrong, fix them:
Use setColor() to set an accent color in a circle behind your icon image.
Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.
So, basically you have to use silhouette icons as notification icon for API Level 21+

UITabBar Large Content Size Image (HUD) doesn't display in Large Text mode

iOS 11 has an accessibility feature that shows a large version of a tabbar icon in a pop-up HUD when long pressed. In a WWDC presentation, it was mentioned this just involves turning on:
Settings -> General -> Accessibility -> Larger Text
..and adding:
tabBarItem.largeContentSizeImage = UIImage(named: "myHud")
Alternatively, you can add a vector image as the main tool-bar image, with 'Preserve Vector Data' checked in the asset catalog.
I've tried all combinations of this, and a long press does not show the HUD. I also tested with the Files app on my iPad running iOS 11b4 with no luck. This is the app that was demoed at WWDC.
Is there some other accessibility setting I'm missing to enable this feature? Or is it not available in beta 4?
It isn't enough to turn on Larger Text. You also have to use Larger Text — i.e. slide the slider way to right.
Then it works — well, the HUD appears. But the icon is not being enlarged within the HUD, so I don't quite see the point:
(As you can see, I'm doing this in a test project where I'm experimenting with the vector PDF image feature.)
This feature implementation and an example with tab bar are perfectly explained with illustrations on this accessibility site but here are the outlines :
Under Xcode, import the image to be enlarged with a pdf extension and a x1 resolution in the xcassets catalog.
In the new Image Set, tick Preserve Vector Data and specify Single Scale as Scales attribute.
If a storyboard is used for this image, tick Adjusts Image Size in the Image View section, otherwise put the adjustsImageSizeForAccessibilityContentSizeCategory image property to true in code.
For your tab bar or tool bar used in the application, first repeat the previous 3 steps for each image included in the items to be enlarged in the middle of the screen and then link the accessibility image to its appropriate item.
This feature is available only for the accessibility text sizes.
WARNING : don't forget to check your layout with these new images larger sizes.
For your record, an explanation of the Large Content Viewer is provided in this detailed WWDC video summary if need be ⟹ the UILargeContentViewerItem protocol is an iOS 13 new feature that shows the same HUD that's shown for standard bar items.
You need to go :
Settings > General > Accessibility > Larger Text(set on) > Move slider more then half to the right
Don't forget to set
tabBarItem.largeContentSizeImage = someKindOfImage
And Long press will does the trick.

iOS 10, Swift 3 - change inactive bar item icon?

I was trying to find answer to my problem but I couldn't figure it out.
I've imported my own icons to icons assets which are white and in .png format and I want to use them in tab bar item. Everything works great but when the screen is inactive the icon is gray. I want it to be white as original. I've tried to change "render as" in assets but then the icon doesn't change when the screen gets active.
Is there any way to fix it?
Thanks for all help. https://i.stack.imgur.com/mzDl3.png
TRY THIS-:
var image = UIImage(named:"your image")?.withRenderingMode(.alwaysOriginal)

Notification Center - Can you replace the bullet icon?

I'm trying to replace the blue bullet icon in the notification center for my app.
I thought that alertLaunchImage would allow me to do this. I have tried doing something like
not.alertLaunchImage = #"customBullet";
but it keeps the default blue bullet. Is the bullet customizable at all?
Update
In the screenshot below, i'm trying to customize the blue bullet on the left. I know already how to customize the main image (in this case the gmail icon)
Nope. It just means "new message" and it's managed by the system, not the apps.

ios - UITabBar images are not rendering on the emulator

I have an image that looks like this:
I am trying to make it render on the UITabBar and here is what I did. I went in XCode to File --> Add Files to Project, then I chose the files I wanted and they got added.
Then when I clicked on the files, on the right side of the screen, under "target membership" the checkbox was checked.
But when I added the file name to the UITabBar item, the emulator showed a blank rectangle instead of just empty space...so it recognized the image...but it didn't render that image.
Would someone happen to know what I did wrong? Are the dimensions of the image supposed to be rectangle or square? I have 48x48 square png file.
Can you check your image info?
These are the guidelines for UITabBar image:
30x30 (48x32)
PNG
Anti-aliased
Transparency set
Custom Icon and Image Creation Guidelines

Resources