2

Previously, it is only an iPhone application. Now I want it run in iPad as well. So I chose the target as universal, but when I run it in iPad simulator. It only remains the color of the view without any labels and textfields. General

How can I make the application run properly both in iPad and iPhone?

7
  • 1
    are you using XIB or Storyboard? If XIB then make sure you have iPad compatible XIB, if Storyboard make sure you have configured proper Size Classes (Any x Any recommended). Commented Aug 24, 2016 at 5:01
  • 1
    check if you are using size classes in main storyboard or not and also if you have configured properly to run your design in iPads also. like @DipenPanchasara said. Commented Aug 24, 2016 at 5:04
  • I use Compact x Any to add labels. Now I want to use Any x Any. But there is nothing on that. I use "Use Auto Layout" and "Use Size Classes". Commented Aug 24, 2016 at 5:05
  • You need to disable Compact x Any constraint from Attribute Inspector, at the end you will see constraint checkbox uncheck wC x hAny and add new constraint of wAny x hAny using + button. Commented Aug 24, 2016 at 5:10
  • Hi @DipenPanchasara, can you explain in detail? How to disable Compact x Any constraint from Attribute Inspector? Commented Aug 24, 2016 at 5:23

1 Answer 1

3

Step 1 : First You need to change your size Class to wAny x hAny. Now when you open your controller all your controls will be visible as disabled, Because you change your size class and constraints defined are not compatible with it.

Controls in different size Class

Step 2 : Now select all your controls in your controller then goto bottom of Attribute Inspector. You will see checkbox for C x Any. uncheck it.

enter image description here

Step3 : Now you have to add new Constraint for Any x Any. As you have already changed your size class to **Any x Any ** just check above check box which will by default activate constrains for current size class.

Activate current constraints.

Step 4 : Then you need to add missing constraints which ever necessary for your controls.

Sign up to request clarification or add additional context in comments.

6 Comments

I followed all the steps, it works well in iPad now. But why nothing in iPhone now?
Just remove compact x any constraint for controls in iphone and add Any x Any. You will get the result
I have removed compact x any constraint for controls in iPhone and add Any x Any, still now not working in iPhone. and its perfectly working in iPad. please suggest.
have you changed your Size Class for Storyboard/Xib? Make sure any control refers any other Size Class constraints.
Yes Dipen, I have changed. Now Im getting iPad and iPhone LandScape mode only, but not iPhone Portrait.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.