asset-catalog

Get Data from XCAsset catalog

扶醉桌前 提交于 2019-12-04 03:09:47
I understand that to get images from the asset catalog i can use UIImage(named: "fileName") to do it. however, what if i am getting DATA from the XCAsset catalog? I can't figure this out. I have tried, let url = NSBundle.mainBundle().URLForResource("fileName", withExtension: nil) let data = NSData(contentsOfURL: url!) But it is nil. I do not know how to get data from the XCAssets catalog. If anyone can help me out (googling hasn't helped) please let me know I will be very thankful! Update: Why am I trying to get data from an asset catalog? I dragged an animated gif into the asset catalog. And

Error ITMS-90096: Your binary is not optimized for iPhone 5

牧云@^-^@ 提交于 2019-12-04 01:25:01
I'm getting this error: Looking in the LaunchImage.launchimage folder I have a Default-568h@2x.png but not a Default-568h.png image. There doesn't seem to be a space for one so how do I add one to this Asset Catalog? Try to clear "Launch screen file" at "App icons and Launch images" arnold In my case, I had a LaunchScreen.xib so I shouldn't have needed the PNG. It turns out that somehow I had deleted it from "Copy Bundle Resources" in Build Phases. Added it again and Apple accepted the build. From iOS9, you should add launch images to your project root, not Images.xcassets folder. And set your

How to use create and use a UIImageAsset in iOS 8

爱⌒轻易说出口 提交于 2019-12-03 13:03:11
iOS 8 introduces a UIImageAsset class with a method registerImage:withTraitCollection: . How do I use this class? Normally, you won't have to. Instead, you'll use an asset catalog. UIImageAsset, in iOS 8, is simply the mechanism underlying image sets in asset catalogs. For example, in iOS 8, an asset catalog can distinguish between versions of an image intended for different size class situations, using the Width and Height pop-up menus to specify different size class possibilities. Then, when you use an image from an asset catalog in your interface, the right thing happens automatically. If

Xcode 6.1 Warning about Launch Image in Asset Catalog

浪子不回头ぞ 提交于 2019-12-03 10:26:44
问题 I am using Xcode 6.1 to create a app supporting iOS 6 and later. .In target's "App Icons and Launch Images", I set the Launch Images Source as "Use Asset Catalog" and Launch Screen File to "LaunchScreen". In Images.xcassets which created by Xcode, I fill in every box for "LaunchImage", but there's always a warning message: Retina 4-inch Support. Applications using Launch Screen Files and targeting iOS 7.1 and earlier need to also include a Launch Image in an Asset Catalog. I created another

Launch images show black, when using Asset Catalog

坚强是说给别人听的谎言 提交于 2019-12-03 06:59:40
问题 In Xcode 5 , I use the asset catalog to manage the app icons and launch images for my app. The app icons work fine on all devices, but the launch images just on a few. I have added launch images for every possible device, and iOS (6.1 and 7.0), that I want to target. I have made sure that all images have the correct sizes , which is confirmed in the attributes inspector (see picture below) where the size of the images match the expected sizes. I have also named all images after the naming

Xcode 6.1 Warning about Launch Image in Asset Catalog

◇◆丶佛笑我妖孽 提交于 2019-12-03 00:54:36
I am using Xcode 6.1 to create a app supporting iOS 6 and later. .In target's "App Icons and Launch Images", I set the Launch Images Source as "Use Asset Catalog" and Launch Screen File to "LaunchScreen". In Images.xcassets which created by Xcode, I fill in every box for "LaunchImage", but there's always a warning message: Retina 4-inch Support. Applications using Launch Screen Files and targeting iOS 7.1 and earlier need to also include a Launch Image in an Asset Catalog. I created another Image Set named as "Default" and fill in the "Retina 4 2x" box with expected image. But the warning

Launch images show black, when using Asset Catalog

[亡魂溺海] 提交于 2019-12-02 20:35:37
In Xcode 5 , I use the asset catalog to manage the app icons and launch images for my app. The app icons work fine on all devices, but the launch images just on a few. I have added launch images for every possible device, and iOS (6.1 and 7.0), that I want to target. I have made sure that all images have the correct sizes , which is confirmed in the attributes inspector (see picture below) where the size of the images match the expected sizes. I have also named all images after the naming conventions , which should not even be necessary with asset catalog (see last picture) . There does not

Does Both Referencing an Asset Catalogue and Including it from a Framework Create Duplication?

我与影子孤独终老i 提交于 2019-12-02 05:44:39
As discussed here & here , the only apparent way to host re-usable images in a Framework's .xcassets file, then use those images in the storyboard / XIB of an app, is to manually create a reference to that catalog file directly within the app's project. This puts the assets within the app's main bundle, and avoids this error when trying to use them via Interface Builder: Could not load the "ImageName" image referenced from a nib in the bundle with identifier "BundleName" My question, though, is: Does this lead to duplication of the assets at build-time? Is iOS smart enough not to double-up

What is the difference between 1x vs r4 or 2x vs r4 or 3x vs r4

回眸只為那壹抹淺笑 提交于 2019-12-02 01:24:58
问题 If 1x image is 100*100 then 2x image is 200 * 200 3x image is 300 * 300 what is r4 dimension should be xxx * xxx There is no documentation on this. FYI: Its not about launch screen image ... the image can be anything like back button etc... 回答1: The answer isn't that straight forward. The important thing to remember is that different iPhone models would automatically use different images from the imageset. The resolution of iPhone-A is not always a simple multiplication of iPhone-B, so the

Accessing an image with specific resolution in the Asset Catalog

北慕城南 提交于 2019-12-01 20:30:57
I have an Image Set called "SmileyFace" which contains a 1x, 2x and 3x image sizes. I want to copy to pasteboard a specific size from the image set. How do I reference the 1x, 2x or 3x programmatically in the code below? let image = UIImage(named: "SmileyFace" ) let image2 = UIImagePNGRepresentation( image ) UIPasteboard.generalPasteboard().setData(image2, forPasteboardType: "public.png") This code copies the 1x. I want to copy the 2x image. I have not found anything in the Apple Documentation that seems to reference this. You can use imageAsset.registerImage() method: let scale1x =