I'm creating one iOS app and I'm using Storyboards to create the UIs. App should support iOS5 and above devices
In MainStoryboard_iPhone and MainStoryboard_iPad I have the UIs designed for the portrait mode.
Now I need to design them to work in landscape mode as well.
What is the best way to do that? Do I need to create another storyboard for landscape mode or is there a easier way?
For each UI I have set a background image using Imageview. Is there a image naming convention, when I used for e.g like myimage-Landscape.png it automatically detects the landscape mode image and sets it?
You could go ahead and create a separate storyboard.
However the actual recommended Apple Guidelines would state that this is what Constraints are designed for.
I learnt from this fantastic tutorial:
http://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-2
Related
I have implemented one universal iOS app for both iPad & iPhone that supports iOS6 & iOS7 in Portrait mode.
Now my new task is to support landscape mode for this app also.
These views are not Auto Layout enabled.
My question is, Is there any great solution for orientation instead of implementing all orientation methods and writing code in each UIViewController class?
I have used too many controls in each XIB file.
Please make suggestions to me.
Autolayout is probably your best option. If you haven't been exposed to autolayout before I suggest reading a tutorial on RayWenderlich.com and watching the autolayout videos from the past 2 or three WWDC's. Several of the 'beginning autolayout' videos address the problem your facing.
I have a Xcode project for a iphone app that has been designed to be universal and has a deployment target of 4.3. The project uses a .xib file for constructing the user interface and I am only familiar with storyboards. My goal is to make the app that only works on the 3.5 screen fit the iphone 5 4-inch screen. Do you guys have any tutorials online or tips on how I can do this? Thanks in advance!
The process is pretty simple:
Make sure you have a Default-568h#2x.png default image. See App Launch (Default) Images in the iOS App Programming Guide for information about these default images, sizes, etc. But by adding this default image, that informs iOS that your app supports the 4" screen.
When designing your NIBs, you can toggle the simulated metrics between 4" and 3.5" to see how the view is rendered for both:
You can then adjust your autosizing masks for your various controls so they resize correctly. This is an example where the margins are all fixed and it should grow as you go to 4" screen:
"All" you have to do is properly set the struts-and-springs "autoresizing masks" in Interface Builder. The same as you'd do for Storyboards.
A friendly tip while at it: don't do storyboards except for the simplest of apps, and don't use auto layout before you're familiar with struts-and-springs and are absolutely sure you can't use struts-and-springs to do your work.
Turn off auto layout in new .xibs here:
Of course, if you have device-specific artwork (such as a background that's exactly 960x640), you'll have to do more work than that, but you're prepared for that piece of the puzzle, right?
Next, add a Default-568h#2x.png file to your project. Make it 1136x640, or if you're not covering the status bar area, make it 1096x640.
I'm trying to recreate the Camera.app buttons and interface from iOS in my own, custom camera application built on GPUFilter. Specifically talking about the Flash, Options, and front vs back camera button toggle that are across the top of the app:
Curious to know if these are built into Storyboards as UI objects or if there's another easy way to recreate these without totally reprogramming. I'm also interested in using the overlay table view that they use (in picture above) for options.
Thanks!
You can using AVCamCaptureManager and AVCamRecorder classes. Apple has a demo program build on its developer site here.
I'm a newbie of iOS development and I'm confused regarding universal app.
We can use the same code, same xib file for iPhone 4(retina) and previous iPhones, but why we should write two different xibs for iPhone and iPad? What's the difference?
For iPhone and retina iPhone, we use "point" instead of pixel for the coordinate. Why we can't use the similar method for iPhone and iPad?
For some simple apps, it is possible to design your iPhone UI and reuse the same xib file for the iPad. Just select your Target in XCode and copy the Main Interface text from iPhone / iPod Deployment Info to iPad Deployment Info. If you're using a Main Storyboard, copy that too. However, the iPad does not simply scale everything up from the 320*480 / 640*960 iPhone screen to the 768*1024 / 1536*2048 iPad screen. #elgarva correctly says that this would look terrible. Instead, the iPad version makes use of your autosizing masks to resize or reposition each view.
If all of your views can be considered to be left-middle-right or top-middle-bottom, this may work. If you have anything more complicated, you'll need to design a separate iPad interface.
Duplicating your iPhone UI is not just discouraged for aesthetic reasons - iPhones often end up containing a deep and confusing navigation tree for tasks that the iPad can fit on a single screen.
The main reason, is that if you just scale the elements on the UI to fit the larger screen, it wouldn't look nice... and you don't need to do anything for it to work, it automatically does it for you if your app is iPhone only and installed on an iPad (if the user chooses to).
Having a different XIB lets you rearrange your app, and think it so that you can take advantage of the larger screen. You can probably show more information on one iPad view than on 3 different screens on the iPhone... so, your iPhone app could show basic info and expand it when the user taps on it, while your iPad version could show all the information on load, plus extra graphics that look nice but aren't needed, and wouldn't make sense on the iPhone screen.
PS: If you're starting a new app, I strongly suggest you using the storyboard if your app won't have a lot of views... it's really easy to get started and it lets you see your app flow at a glance.
The ratina display just doubles the resolution of original iPhone. If you don't provide separate graphics for retina display, then system just doubles the resolution of resources.
The points are related to physical size of screen, which is similar in old and new iPhones.
For iPads, the screen size changes. This means that its dimension in points will be different from that of iPhone.
duplicating the xib file and renaming that as filename~ipad.xib is working great for me in ios6.1
I have an iPhone app that I want to change into an iPad app. I do not want to make it universal. The result should be an iPad only app. The main problem I see is converting all of my .xib files. I realize that I will have to change some things around manually, but I would like as much as possible (including all of the painstakingly made connections in IB) to carry over. Also, if there are unlikely places where I need to change settings, please give me a hint to that as well. Thanks!
Xcode has a convert option. It gives you the choice between a new app or a universal one.
This will convert all your NIBs, but quite how useful that is will depend on how thorough you've been with the sizing options in Interface Builder. For me is mostly worked. A couple of minor tweaks for a couple of views and a complete rewrite for some others.
Of course you'll also have to work with view controllers that "manually" build the view.
The gotchas I found were around orientations (iPad apps should work in all four orientations) and with the screen size. There are also some oddities with the keyboard and modal views if you have any of those (there are a few kinds of modal view, and the keyboard does not always dismiss). As ever when you're making automated changes, testing is key.
The full process took me a lot longer than I was expecting.
Few thoughts for changing iPhone app to iPad app.
Xcode has the provision to change the current iPhone app to iPad app by using "Upgrade current target for iPad" menu command.
http://www.enscand.com/roller/enscand/entry/ready_for_ipad
resize all current view to the ipad size 768*1024(portrait) and then resize all the subviews respectively. the connections doesn't get lost by doing this.