Outlets in Xcode 6 (Universal Application)

2

I have a problem / doubts. Until today due to some needs I have developed only for iPhone or iPad separately, however today I am starting in the development of universal application, iPhone and iPad.

I'm using Xcode 6 and developing directly for iOS 8. I was able to adapt the screens for both devices, it was cool except for the fact that: when I built the screens using storyboard , I added a UITabBar and referenced it as Outlet in my parent. When I adapted to the iPad screen, I had to add another UITabBar (actually I had to add all the components as it was empty). When trying to reference as Outlet in the class, I could not because it "overwritten", losing my outlet from the iPhone screen and vice versa.

My doubts are as follows:

  • What is the best way to do this?
  • Every time I create a screen for the iPhone and adapt the screen to the iPad, will I have to add all the components again?
  • If you override, what is the correct alternative to do this?
  • Will I need to have two controllers? One for iPad and one for iPhone?

IMPORTANT: To know how I create the layout and codes: I did not write any code, I'm still in the stage of creating the screens and create the layout in the same way as in this video: link

    
asked by anonymous 03.02.2015 / 02:28

1 answer

1

In fact, it is not possible to reference a same IBOutlet if you have different layouts for iPhone and iPad, for example.

If you are drawing a single layout in wAny | hAny mode, please note that in the preview and even in the video you indicated, you can use the same component and the key is to use the > constaints correctly.

As in your case, UITabBar you get the same result universally and with the same IBOutlet by applying the constraints width, central alignment, fix next to the footer, and so on.

    
03.02.2015 / 13:12