visual assets in iphone app / xcode - iphone

I am new to ios dev, and wondering what are best practices to manage visual assets that are integrated into the app in xcode. Do people have copies of each UI for each form factor, including orientation? resize programmatically? other ways? I am doing all my UI programmatically but no idea whats the best way to manage the assets, meaning, the actual PNG files.

Whenever possible, I like to use resizable images. UIImage has a method resizableImageWithCapInsets:resizingMode: which takes a condensed image and stretches the center row, column, or single pixel as wide or as tall as you want it. This is how iOS creates a lot of its buttons, including the buttons seen in action sheets.
If you need to have separate assets for orientations, I would recommend using suffixes on the file name. So you might have Button-Portrait.png and Button-Landscape.png. You could also add a category on UIImage that takes an image name, detects the current orientation, and gets the actual image file.

Related

scalable ios splash image in xamarin forms

I am working with xamarin forms and now I am seting the IOS splash image in the splash.storyboard... I followed some tutorials and I setted "W any x H any" and "generic" in the configurations required...The image appears, it is a background image. The problems is: If I select the GENERIC option, the image is too large and in the iphone it doesnt seem good...I need a Scalable Splah image, how can I do that?
I am using windows for it...but I can use a mac too.
You can add an ImageView into the ViewController instead of setting the BackgroundImage of the root view. With this, you can have the flexibility to set constraint according to your needs. You can learn more about auto layout HERE.
In addition, you can also set image with different resolution in iPhone and iPad inside your asset catalog.

IPhone Ipad Dual app Cannot figure out how to specify 2 icons for a dual app

I am writing my first dual app and cannot figure out how to give tell it about the 2 icons to use
I read the following documentation
To specify the icons for your app, add the CFBundleIcons key to your app’s Info.plist file. The contents of that key include a list of filenames intended for use as the primary app icons. The filenames can be anything you want, but all image files must be in the PNG format and reside in the top level of your app bundle. When the system needs an appropriately sized icon, it uses the information in the key to choose the image file whose size most closely matches the intended usage.
I cannot figure out how to do this.
As Dan mentioned, you only need to drag and drop your images into the proper boxes (iPhone icon box, iPhone Retina icon box, etc).
You'll need the PNGs in the proper size, though. You can find information about sizes at the following link: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html
Also if you are using images for your elements (UIButton, UINavigationBar, etc), it's a good practice to name *#2x.png your retina display artwork, like:
navBarBackground.png <- Normal screen
navBarBackground#2x.png <- Retina screen
Edit: This way, your application will automatically use the proper image file with the proper screen.
If you are using Xcode 4+, then all you need to do is click on the project file at the top of the project navigator, then select the target you are building for, and then drag and drop your icon files into the appropriate boxes in the summary view

Saving pictures for iphone and android from Photoshop

Saving pictures for use in iPhone and Android applications is a real bore.
Having to make 2 separate versions for iPhone is tedious enough and then creating 3/4 versions for android (or more) is just as difficult.
Is there no way to make one set of pictures in photoshop and have them save in the various formats and sizes for iphone and android?
For instance creating them at the highest resolution necessary and it does all the resizing and such automatically (as if you were to change the image size).
Or am I really going to have to refactor each and every image in my apps?!
Thanks
Tom
I think Adobe Device Central and actions/macros in Photoshop may help you to solve your task.

What size images should I use in order to support the two iphone resolutions?

I have a few questions about screen resolution, that I'm not clear on. These questions assume they my app will be running on iOS 4.0 and up, and on either iPhone 3GS or iPhone 4.
Should the size of the splash image (default.png) be (960x640) or (480x320)?
Should the size of the app icon (Icon.png) be (57x57) or (114x114)?
What about other graphics that I may use in my app, such a graphic that represents a button? Should I always create these images for the higher resolution, and have the app scale them down? In other words, if I want a button image to be displayed on the 3GS that is 200x40 - should I create the image at 400x80, so that iPhone 4 can take advantage of it?
Thanks!
A good guide to this can be found here: http://mobile.tutsplus.com/tutorials/iphone/preparing-your-iphone-app-for-higher-resolutions/
In general you just create 2 sets of images. Your original and then a new one twice as big with #2x in the name. So for image.png at size 32x32 you would have one that is twice the resolution called image#2x.png at size 64x64. In your app just always use the image.png in Interface Builder and when loading in code.
There is no need to detect the device. These images will automatically be picked up by the OS and subbed in as necessary.
Provide both sizes (960x640 & 480x320) for the splash image using the #2x method described above
Provide both icons (57x57 & 114x114) using the #2x method
For our apps we use a combination of the #2x images and just Scaling the large images. (More information on this can be found in the above article) We use the #2x images for bar buttons, icons, etc. But for UIImageViews we often just use the Scaling. There can be a performance hit for doing this, but for most apps I'd say this is negligible. The savings in file size sometimes make scaling the only option.
Related Questions:
Retina/non-retina images in UIImageView
Making an app Retina Display friendly
You need to provide both if you want them to look nice. For example,
Default.png -> (480x320)
Amd
Default#2x.png -> (960x640)

iPad/iPhone duplicate view and resize?

I'm working on an app that is similar to a Presentation application (Keynote/Powerpoint) for the iPad, that will use the VGA adapter to present on screen. However, if the presenter is using the external display for the presentation, I'm wondering if it's possible to have a miniature version of what's on the external display show up on the main iPad display (along with the presentation controls, which will take up most of the screen). In other words, I'm looking for a way with the iPhone SDK to "bake" the contents of a View (which will contain various Images and Labels in various locations) to an image (or some other static storage), resize it, and re-display it in another view.
It would need to be smaller (since I don't want the 1024x768 external display to completely overlay the iPad's main display, only a corner of it), and either live-updating (literally an instance of the other View, just scaled), or be able to be refreshed, such that when updating the external display, the "picture in picture" version of itself would be updated too.
It might be easiest to just have two instances of a view - one that is the full size on the external display and one that has its transform property set to fit in the preview window (and then update both simultaneously).
Otherwise you probably have to dive into Quartz and use the view's layer property to render it to a context (see CGBitmapContextCreate) and draw that onto a tiny view (this is all speculation of course).