Watch app custom menu image not showing? - ios

I am just creating watch app and adding custom menu image but it's not showing.
Got this guideline - Menu Image Guideline
And created the icon 80x80 in png format.
Naming it comment.png.
What am I doing wrong? Any help?
Edit 1- Added images in WatchAppImages.xcassets and now its looking like -

Are you calling setContextMenuOptions in your WKInterfaceController?
- (void) setContextMenuOptions
{
[self addMenuItemWithImageNamed:imageName title:title action:action];
}
And, where is the image added? should be in WatchAppImages.xcassets not in WatchExtensionImages.assets.
Also, your png should be name for retina display: iconImage#2x.png added in your assets in the blue square of the next image(in 2x, not for 1x or 3x):
Hope it helps.

Related

UIImage from UIApplicationShortcutIcon

There are some great "Quick Action Icons" available at https://developer.apple.com/ios/human-interface-guidelines/graphics/system-icons/.
Is it possible to make a UIImage from one of these UIApplicationShortcutIcons to use on, say, a UIButton. For example, the mail icon:
let mailIcon = UIApplicationShortcutIcon(type: .mail)
let mailImage = UIImage( ... )
Any help would be appreciated. Thanks.
You cannot use Quick Action Icons as an normal image or cannot set in a button image. These are only for 3D touch shortcuts. When you press on application icon and it display shortcut menu for quick action. You can use these icons here. Even it allows to use our images as an quick action icons.
Also you can refer below URLs as a reference :
How to add custom images as UIApplicationShortcutIcon for UIApplicationShortcutItem?
UIApplicationShortcutItem - Can I use an image downloaded from the web as UIApplicationShortcutIcon?
https://developer.apple.com/reference/uikit/uiapplicationshortcuticon
These images are not available using normal API, but they are part of the UIKit bundle. You can use a tool, such as iOS-Artwork-Extractor, to extract the 1x, 2x and 3x variants of those images, and then you can add them to your project.
you can do something like this now:
<dict>
<key>UIApplicationShortcutItemIconFile</key>
<string><your image name from assets catalog></string>
</dict>

iOS App Issue - Can't access image from image asset catalog

I'm new to iOS development, so apologies for advance. I know this has been covered earlier but I can't seem to find anything that helps with my issue.
Its a fairly simple but annoying issue.
I have a image in assets with a file name of hollwood.png but a xcode name, "hollywood" (no png).
I am trying to set a UIImageView to display it.
So in ViewDidLoad I have the following: (imageContainer is the UIImageView IBOutlet)
- (void)viewDidLoad {
super viewDidLoad];
self.model = [Model sharedModel];
self.imageContainer.image = [UIImage imageNamed:#"hollywood"];
}
I can not get it to display the image from Assets.
I know the UIImageView outlet works correctly because I can have the app choose a photo from gallery and set the photo to UIImageView.
I'm having a very difficult time figuring out how to load the image I saved in the assets catalog into UIImageView.
I just had this issue. I had dragged the image and for some reason Xcode added a weird "Design" locale and I couldn't load the image using UIImage(named: ). I don't know if this is your case, but you can try right clicking on the image in the Asset Catalog, "Show in Finder", opening the folder and checking the "Contents.json" file. Each image there should only have the keys "idiom", "filename" and "scale".
Make sure your image is added in Compile Sources
AppTarget->Build Phases-> Compile Sources
If not try to add that and check.

Why does the Images.xcassets not accept my jpegs?

I'm following along with Paul Hegarty on iTunesU and he adds jpegs to his project by selecting a group in finder and dropping them into the view associated with Images.xcassets. In my project that view has white icons called AppIcon and LaunchIcon. In the tutorial the jpegs are dropped and added, then a simple [UIImage imageNamed: ... can load them into the running program. But when I try to drop images onto the area, nothing happens.
I tried adding them to the project tree view on the left, and they were accepted there, but didn't get [UIImage imageNamed: to work.
Any idea what is wrong here?
TIA
Mark
There is no where such written that we have to use only png for assets catalog, but only I have seen at Create and Set iOS Launch Images they are saying for png, why don't you convert your jpg to png and give a shot.

Image invisible in iPad because wrong Xcode folder management

I have small problem. When I launch my app in emulator it works just fine, but when I launch it on my iPad I cant see the images of the buttons. The background is OK. Image 1.jpg is shown, but images in General folder like contour buttons is invisible on iPad. Other images like Glasses.png that in other screen are shown fine also. The image 1.jpg is defined via code:
- (void)viewDidLoad
{
[super viewDidLoad];
[mainImgae setImage:[UIImage imageNamed: #"Iview images/Bike/100/comp/1.jpg"]];
}
And other images for buttons selected via storyboard. I think my folder management is wrong, but i have to manage it in folders, so they will be in folders at my project folder.
[mainImgae setImage:[UIImage imageNamed: #"1.jpg"]];
this is enough for putting image for mainimage.,.

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