Xcode 7 what is the view “semantic” storyboard set

2019-02-03 02:30发布

问题:

I see that iOS9 and xCode7 introduced a new field called "semantic" into storyboard config. A google search did not reveal relevant results on top.

What is the significance of the view semantic field?

回答1:

There is a new internationalization support in iOS 9, which enables flipping of the interface from left to right and vice versa depending on the current system language. You can choose Arabic language to test it. Arabic is read from right to left, so the interface is flipped.

Here you can read the Apple's guide on it.

The property "Semantic" in the storyboard is a rule which allows the iOS to know if the view should be flipped or not. There are multiple options:

  • Unspecified - The default value for views. The view is flipped when switching between left-to-right and right-to-left layouts.
  • Playback - A view representing the playback controls, such as Play, Rewind, or Fast Forward buttons or playhead scrubbers. These views are not flipped when switching between left-to-right and right-to-left layouts.
  • Spatial - A view representing a directional control, for example a segment control for text alignment, or a D-pad control for a game. These views are not flipped when switching between left-to-right and right-to-left layouts.
  • Force Left-To-Right - A view that is always displayed using a left-to-right layout.
  • Force Right-To-Left - A view that is always displayed using a right-to-left layout.

Source - Apple's documentation