如何使对象 ID 人类可读? [英] How to make Object ID human-readable?

查看:34
本文介绍了如何使对象 ID 人类可读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

故事板上的每个 UIView 都有一个唯一的对象 ID,类似于:kvf-NI-koG

Each UIView on a storyboard has a unique Object ID which looks something like: kvf-NI-koG

我想知道有没有办法让它更人性化,例如myLabel"?

I'm wondering is there a way to make this more human-friendly, for example 'myLabel'?

推荐答案

您无法通过 Interface Builder 更改对象 ID.

You cannot change the object ID through Interface Builder.

Xcode 使用故事板(或 XIB)文件中的对象 ID 从其他对象中引用该对象.由于故事板(或 XIB)是一个 XML 文件,您还可以差异"文件的版本以尝试理解(或合并)更改,并且对象 ID 可以帮助您将文件中的实体与界面中的对象相关联生成器.

Xcode uses the object ID in the storyboard (or XIB) file to refer to that object from other objects. Since a storyboard (or XIB) is an XML file, you can also "diff" versions of the file to try to understand (or merge) changes, and the object ID can help you correlate the entities in the file with the objects in Interface Builder.

公共 API 不公开对象 ID.因此,从您的程序的角度来看,对象 ID 甚至不存在.

The public API doesn't expose the object ID. So from your program's point of view, the object ID doesn't even exist.

您可以设置视图的标签(在带有占位符Xcode Specific Label"的文本框中).该标签用于文档大纲(沿着 Interface Builder 窗格的左侧),以及连接连接和约束时.但该标签也不会在公共 API 中向您的程序公开.

You can set the view's label (in the text box with placeholder "Xcode Specific Label"). That label is used in the document outline (along the left side of the Interface Builder pane), and when wiring up connections and constraints. But that label is also not exposed to your program in the public API.

这篇关于如何使对象 ID 人类可读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆