iPad/iPhone duplicate view and resize? - iphone

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).

Related

How do I use size classes in conjunction with views in Storyboards in iOS 8? My views aren't showing up

Perhaps I have a fundamental misunderstanding of how size classes in iOS 8 work, but as I understood it from watching session videos they allow you to define different configurations for views depending on two broad sizes that represent two device types (a small one and a large one), thus allowing you to use one Storyboard for iPad and iPhone and landscape and portrait, but just select the right size class for configuration.
Say I want to create my interface for an iPad in portrait orientation. In Storyboard it's a 3x3 size class grid, and I'm inclined to select 2x3, a compact width and a large height, which makes sense for the iPad, no?
When I inspect a view, at the bottom I have two checkboxes, a simple "Installed" one with no extra text, and one with "w Any h R Installed" beneath it. When I have only the bottom one checked (seemingly default behavior) and run it, no views show up. If I check the top one with simply "Installed" as well, it does show up.
So what's going on? Am I using the wrong size class? Am I selecting the right size class in the inspector? Do I have to individually select something for each view?

Submitting an app only for iPhone 5/5s/5c

I've worked on my application for a couple of months, I hired a designer to do the UI and every screen in the app is based on 3 main elements - top bar, bottom bar and content.
I tried to use auto-layout and setting the top and the bottom bar was a piece of cake, but the image I use for a background in the content view shouldn't be resized (it's based on circles and they turn into ellipses).
Is there a way for me to submit the app only for the iPhone 5/5s/5c?
You can't specify device types within the iPhone category. Your best bet is either to design a layout that can work for both screen sizes, re-design the layout so it automatically displays a "4S version" and a "5 version" depending on the user's device, set it to a ScrollView so the user just scrolls up and down to see the full page, or design it so the individual elements can be cropped (or squeezed together) on the smaller screen without actually resizing the individual pieces.

visual assets in iphone app / xcode

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.

Converting an iPhone app to universal; bounds vs frames

I'm trying to convert an iPhone application to work universally (on both iPhones and iPads). I've managed to get the frame to re-size correctly, but it seems like the bounds (the part the user can actually interact with) isn't re-sizing appropriately with it. So, for instance, a UIWebView will be drawn in the correct dimensions, but I can only interact with it within a smaller confine the size of an iPhone screen.
Any thoughts what's going on?
How are you re-sizing this view? Is it in an xib with autoresizing mask set to properly expand? If so something else is going wrong. I just tried making a sample project with a webview, where the xib is sized for iPhone. I then marked the application as universal, and it runs just fine in the iPad simulator with all areas touchable.

For UIImage, use of #2x w/o duplicating files

Beginner here. My app shows an UIImage (in a scroll view).
If you are on retina device, then it should not scroll and I set the scroll view frame to be
the exact size (640x960).
If you are not on a retina device then it should scroll, so I set the scroll view frame to the pixels (480x320).
I have this working by setting the frame sizes, as mentioned, in viewDidLoad()
So...my question is that I have to keep both images on disk. I have pix.png and pix#2x.png and they are exactly the same thing.
Any help on how to handle this? Maybe it is obvious, but not to me ;-)
thx!
In my opinion,If you load the image with the two file name, I think you should keep them on disk.If not, you can delete one of them. Nomatter what pixels size you set, the original pixels datas are always which image file you load from disk.
No, you shouldn't need two copies of the same image. The #2x scheme is just lets you automatically load a high resolution image when one is available. It sounds like you're already managing your scroll view's content size and things are working, so you can just get rid of the pix#2x.png file.
I'm not sure it's a great UI decision to change the app's behavior based on its screen resolution, though. Since you're already using a scroll view, it can be easy for the user to zoom in and out. Non-retina devices will display at native resolution when zoomed in; retina devices will display at native resolution when zoomed out.