asset-catalog

Xcode asset catalog support for 3.5“, 4”, and 4.7" @2x images?

烂漫一生 提交于 2019-12-12 22:30:35
问题 Xcode offers asset buckets for 1x, 2x, 4" 2x, and 3x assets. My fullscreen assets are all wonky with this configuration, because the 2x bucket is used for 3.5" and 4.7" screens. Currently I have a UIImage category that introspects the current screen size, and selects a "*-3.5" asset if the device seems to be 3.5". This is clunky and not cool. Seeing that Xcode caters to all the different device sizes for their LaunchImage asset, I was hoping there was some way to supply device specific assets

How to use create and use a UIImageAsset in iOS 8

让人想犯罪 __ 提交于 2019-12-12 07:56:52
问题 iOS 8 introduces a UIImageAsset class with a method registerImage:withTraitCollection: . How do I use this class? 回答1: 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

XCode iOS7 Asset Catalog Warning - Only Supporting iOS8

冷暖自知 提交于 2019-12-11 10:19:30
问题 I am supporting iOS8 and greater in my App. However, I cannot get passed this Image Asset warning. What file am I missing? See the below screenshot: an iphone retina (4-inch) launch image for ios 7.0 and later is required 回答1: You've suppled images for 4.7 and 5.5-inch devices but you need to have one for 4-inch devices as well (pre-iPhone 6). You will need to select the checkboxes under "iOS 7 and later" (iPad ones if you're making an iPad app, iPhone one if iPhone app, all if Universal) at

Storyboard doesn't display assets after migrating to Asset Catalog

本秂侑毒 提交于 2019-12-10 22:22:42
问题 After migrating image resources to an Asset Catalog the app builds and runs correctly but the assets don't show up in Xcode's storyboard. 回答1: In my case this occurred because I used the full asset name including file extension (i.e. '.png') in Storyboard. However, the name for the asset needs to match the name of the Image Set in the Asset Catalog: So by removing '.png' from the image name in Storyboard it solved the problem. 回答2: I've encountered a similar problem that storyboard just not

Any Fresher Ways to Access Images in Asset Catalog Programatically?

心已入冬 提交于 2019-12-10 11:22:43
问题 I'm using an asset catalog with Xcode 5.1 and making an app for iOS 7 and above. The idea behind an asset catalog is that you can call the images whatever you want and the catalog associates the image with the correct device and orientation. In the background, Xcode apparently renames the files along the scheme mentioned here. However, it appears that there is a steady supply of problems accessing the files programmatically (here, here or especially here) without running into memory problems

Get Data from XCAsset catalog

倖福魔咒の 提交于 2019-12-09 15:10:10
问题 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:

Use vector artwork for iOS launch image in asset catalog?

只愿长相守 提交于 2019-12-09 03:17:07
问题 Is this possible? It looks like I am going to need 9 different launch images, so replacing them all would be a bit of a chore. 回答1: Unfortunately, I think you can't use vector artwork for ALL of your LaunchImages... ... but there's an approach which makes our lives easier: the new LaunchScreen.xib . In File > New, you create a new Launch Screen in User Interface: Now, you can set the new Launch Screen File in your project's target: In this LaunchScreen.xib you can put your vector artwork,

How do you use an asset catalog image's slicing information programmatically?

心不动则不痛 提交于 2019-12-07 06:26:01
问题 I used to have an image in my project and I would load it like this: UIImage *image = [[UIImage imageNamed:@"image_name"] resizableImageWithCapInsets:UIEdgeInsetsMake(10.0f, 10.0f, 10.0f, 10.0f)]; Now I put that image into XCode 5's new asset catalog and I set the slicing for it. How do I use that image in my code so that I don't have to explicitly call resizableImageWithCapInsets when loading the image? Said another way, how do I take the slicing information stored in Images.xcassets and

Differentiating images in an asset catalog by their group

北城以北 提交于 2019-12-06 23:52:04
问题 Is there any way to use asset catalog groups to effectively namespace multiple images with a shared name? For example, if I have multiple images named Foo that are in different groups, is there a way to specify which one I would like with imageNamed: (i.e. something like UIImage(named:"Group1.Foo") ). Obviously I could create unique names myself for all images, but it would be nice if there was a way to leverage groups to do it for me. 回答1: Select each folder in your asset catalog that you'd

Asset Catalog Error: CUICatalog: Can't find rendition for name

断了今生、忘了曾经 提交于 2019-12-06 07:41:15
问题 All of a sudden, and through no apparent changes on my end, I am now getting the following error from an image in my asset catalog: 2013-10-30 14:44:46.629 MyApp[38590:a0b] CUICatalog: Can't find rendition for name: LoginBackground scale factor: 2 device idiom: 1 device subtype: 0 2013-10-30 14:44:46.638 MyApp[38590:a0b] Could not load the "LoginBackground" image referenced from a nib in the bundle with identifier "com.mybundleid" I have tried removing the image assets and re-adding them, to