Storyboard: Assign IBOutlet for Multiple Objects to Dimension Class

Since Apple introduced Size Classes

, I thought the chore might disappear. Going further, I realized that it was not so easy, as convenient as it seemed.

My actual goals are slightly different in that I created a test project to illustrate:

I have one storyboard

, one IBOutlet

for UIButton

and decided that this button looks different for differentSize Classes

For this, I created two buttons:

  • IPhone Button (installed for wChC)
  • IPad button (installed for wRhR)

enter image description here

Problem :

every time i try to connect any of these buttons to IBOutlet button

- it always works for one button and removes the connection to the other.

enter image description here I want these two buttons to be actually one button, but with a different layout for iPhone, iPad. Previously, having two storyboards was not a problem.

How do I do this within a single storyboard?

+3


source to share


1 answer


If you developed separately for iPhone / iPad , you cannot have the same IBOutlet connection for both buttons. Better to create a separate IBOutlet for iPhone / iPad.



Use Any <Any in storyboard to support iPhone / iPad design with one IBOutlet.

+2


source







All Articles