Convert only iPhone App to Universal App in Xcode 7.2 - ios

I followed a tutorial at Udacity to create an iPhone app and I am not only able to run it on an iPhone as I can in an iPad, that's fine. Nevertheless, the screen looks weird on an iPad. In my storyboard, if it is selected "compact,any" and if I changed it to "any, any" it should work, I think, but the elements in the "company, any" format do not come automatically.
I looked it up on google and found http://pinkstone.co.uk/how-to-convert-your-iphone-storyboard-into-an-ipad-storyboard/ - but this is for Xcode 6. I followed the steps:
change from iPhone to Universal in the project settings
duplicate storyboard file using Finder
Add new storyboard file to project
He says to use a button called "Apply Retina 3.5-inch Form Factor" whose icon looks like a person, but it is does not appear in Xcode 7.2. I think that was changed to the "any,any" options that appear on the bottom.
Change part of xml code of storyboard from targetRuntime="iOS.CocoaTouch" to targetRuntime="iOS.CocoaTouch.iPad"
The steps below just made "compact,any" to "any,any" in the new file but with no buttons, views or labels of the "compact,any". Is there a way to do that? I tried copying and pasting also... but it didn't work quite well somehow... maybe I did it wrong.
I am also wondering if I do need to create a new storyboard file. It seems like the "compact,any" is somehow independent of "any,any" and the same file would work for iPhone and iPad.
I am using only Swift for the development language, although I don't think this is relevant for the layout.
That's what I have thought regarding the question.

Answer to your question: You have to create them for each size class, individually.
Explanation: Your constraints and items in your storyboard are created for a custom size class. You cannot just "copy" your constraints from one size class (compact, any) to another (any, any).
Your question title isn't accurate- you're not asking how to "convert" an app from iPhone to Universal (which means it can be used on iPhone and iPad). You've done that already- in your project settings, so it is now "converted" to be a universal app (even though it's useless to you on an iPad, it is still "supported")- and you've answered your own question.
What you're asking (I think) is how to copy your elements and constraints to another size class, which you can't just "copy". What your question should be is this:
"Convert storyboard views from (compact,any) size class to (any,any) size class" to which there is no easy way- it must be done manually.
Your question is a potential duplicate of many others I found. Here is a related question that has an answer that might help you.

Related

Different versions of app for different devices - iPhone to iPad

I'd like to take my existing iPhone app and modify its layout/number of screens for an iPad.
I began by duplicating the Target with "Duplicate and Transition to iPad".
But I'm unsure where to go after that. I'll need a new Storyboard and some of the functions/viewControllers/views will need to be modified. Where/how do I do that?
All I can find are very old solutions that are no longer valid or leave too much out:
How to convert iPhone app to iPad app
This is the best one I've found, but again not current and still leaves a lot out:
http://innovationm.co/convert-iphone-application-to-universal-application/
I no longer see a "Universal" option. I am guessing that selecting all of these accomplish the same thing?
First, edit your target to make sure it is set for both iPhone and iPad:
Second, using two different storyboards is unusual nowadays, but you can easily do it. In your Info.plist configure two entries (using Raw Keys and Values): UIMainStoryboardFile and UIMainStoryboardFile~ipad. The result is that your app will load one storyboard for an iPhone and a different storyboard for an iPad.
Note that with a newer created project that uses window scenes under iOS 13 and later, you would configure UIApplicationSceneManifest and UIApplicationSceneManifest~ipad to specify different UISceneStoryboardFile values.
Here's a downloadable project that demonstrates the newer structure:
https://github.com/mattneub/Programming-iOS-Book-Examples/tree/master/bk1ch09p358universal

iOS - Open a different Stroryboard based on the device size

I have created an app in Swift and I want it to be available in both iPhone and iPad, but I would like the iPad to have a couple different layout variables, such as bigger buttons and pictures. Using auto-layout or Size Classes with constraints wasn't working and not letting me put them where I want them, so I was wondering how to make it so that when I open the simulator with an iPad, it opens the storyboard with the different View Controller layouts. I made a duplicate storyboard so I have main.storyboard and the copy is mainiPad.storyboard for the iPad only. If this can be done, please let me know! Thanks!!
This Tutorial is the old way, when You simply add iPad suffix in the file name.
This Post is the new way, introduced in Xcode 6; You simply select the storyboard name for ipad and iphone family in application plist file.

Custom font displaying on iOS Simulator but not on Storyboard

"I have my custom fonts working fine when they are running on the simulator, but is there any way to view custom fonts in the storyboard itself while I'm working? My text doesn't match the size of the default font so I have to keep compiling and running the code and eyeing the correct size by trial and error over and over.
I've seen a few questions hit on this, but it's just bringing up how to upload custom fonts."
I have copied paste this question from Viewing Custom Text in Xcode Storyboard since it describes exactly what I am having trouble with but he had XCode 4 and I have the 5th version. Is there any solution for the XCode 5?
Unfortunately this is a well established bug. Custom fonts do not appear correctly in Interface Builder. You should file an enhancement request with Apple. Until they fix it, you'll just have to live with it.

iphone-Xcode 5 xib/storyboard Problems

Okay- I have this space shooter app based on uiimageviews. Originally, I made it on Xcode 3. Then, I converted it to Xcode 4. However, I did not use story mode. I stuck with the .xib files and it worked fine after I edited some of the basic code around. Then, when Xcode 5 came out, I couldn't do that anymore. When I tested my app on the iPad, most of the screen was grey and only the top corner had my game in it. I would like it to be able to auto size using just the xib files. Also, with the 4 inch and 3.5 inch iPhones, how can i make a view that fits them all? I tried storyboard, but my app was based on .xib files. It is one view controller, but it loads a lot of different .xib 's. What is my solution?
The solution is to switch your app from universal to just iPhone.
You can find a solution to a problem, similar to the one you are having, in the following stackoverflow How to convert a project using XIBs to Storyboard?

iOS XCode Storyboard controls moved and now look strange in simulator

I am following the course on iOS through iTunes university and working on the calculator project. I moved the controls on the storyboard to make room for another control at the top. Everything looks fine on the storyboard but when run in the simulator, controls are bunch up, on top of each other, and some are clearly off the top of the simulator screen. This leads to the following very related questions.
How does one move controls around on the storyboard? I went to the size inspector of each control (buttons in my case) and changed the 'Y' value (increased it by 10). I did this for each control. I didn't think about it as I was doing it because as I said, all looks fine on the storyboard. Is there a better way to move controls around? I could not figure out how to grab more than one control at a time and move them. Grabbing all and moving or all but one and moving would have been ideal.
I anticipate someone is going to say, "We need more info. " How do I show the storyboard? Is there a xml file somewhere? How is the storyboard saved? How should I show the results of the simulator?
In general, what the heck is going on? Why would things look so different in the simulator?
Is there a better forum/group to ask newbie questions about iOS programming?
My specs are these:
XCode 4.5.2
Ios simulator versions set to 6.0 and iPhone
Any other info needed? Thanks in advance,
Dave
Try setting your simulated device size to 'freeform' instead of 'inferred'. This screen is a bit smaller so the controls are no longer overlapping. The latest xcode sets it by default to ios6 (screen size of iPhone 5)
edit For a better insight in xcode IDE, please refer to the documentation provided by apple (includes screenshots for clarity)
https://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/000-About_Xcode/about.html#//apple_ref/doc/uid/TP40010215

Resources