Is it possible to comment on storyboards?

2020-04-09 01:33发布

So I've been using Xcode 7's new feature to reference storyboards within storyboards. To add clarity to my references, I want to add a comment of sorts that can explain exactly why I've split up my storyboards.

Does this feature exist? I know I can create some dummy views but I feel like this is lazy and a bit inefficient.

3条回答
甜甜的少女心
2楼-- · 2020-04-09 02:11

This is a good way of commenting visually on a storyboard, but still isn't perfect and is still a dummy view. I find it is probably the cleanest way to do it right now.

  1. Add a Storyboard Reference to your storyboardenter image description here
  2. Navigate to the Identity Inspector on the Storyboard Reference you addedenter image description here
  3. Set the Label attribute to your desired commententer image description here
  4. You can now move the your comment wherever you want inside the storyboardenter image description here
查看更多
一纸荒年 Trace。
3楼-- · 2020-04-09 02:21

You can place comments inside the source code of the storyboard. Since .storyboard files are XML-based, you can write standard XML comments in it:

<!-- This is a comment -->

To open a storyboard as source code, right-click on the file in the Project navigator (the first icon from the left on the right sidebar) and select Open As/Source Code:

Open As/Source Code

To return to Interface Builder, select Open As/Interface Builder - Storyboard from the same contextual menu.

WARNING: Always place these comments after the first line of the file, since Xcode expects an XML declaration there.

查看更多
\"骚年 ilove
4楼-- · 2020-04-09 02:28

In you identity inspector there is a place you can write notes, that's basically your comment section.

  1. Select your storyboard Object
  2. Click show the identity inspector. enter image description here
  3. Then write your comment in the document note section.

enter image description here

查看更多
登录 后发表回答