2

I want, using the storyboard, to add a UIBarButtonItem to a UIToolbar, but only for width:Regular and height:Regular devices.
In the bottom of the storyboard, I activate „Vary for Traits“, and select width and height, so that only iPad devices remain.

If I draw an UILabel to the canvas, the attributes inspector shows me, as expected, 2 „installed“ fields, one for all devices (unchecked), and one for wRhR devices (checked):
enter image description here

However, if I draw a UIBarButtonItem to my toolbar, these fields are not shown.

Does this mean that a toolbar cannot be customized depending on size classes?

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116

1 Answers1

0

Briefly speaking, size classes, or vary for traits, only work for UIView objects, but UIBarItem/UIBarButtonItem inherits from NSObject, not UIView.

Black.Lee
  • 344
  • 2
  • 7
  • Thanks for your answer. This might be the solution, but I was not able to find anything in the docs that says that size classes apply only to `UIView` subclasses. Do you have a reference? – Reinhard Männer Jun 08 '17 at 19:42