可以在代码中访问身份标签的值吗? [英] Can the value of the Identity Label be accessed in code?

查看:45
本文介绍了可以在代码中访问身份标签的值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在界面构建器中有许多标签,这些标签都设置了标识(标识检查器> 标识 > 标签

I have a number of labels in Interface builder which all have their identity label set (Identity inspector > Identity > Label.

我现在想在我的代码中访问这些标签。这通常是可能的还是这个仅出现在界面构建器中?

I would now like to access these labels in my code. Is this generally possible or is this only present within Interface builder?

推荐答案

无法访问每个标签身份检查员> 标识> 标签。为了更好地了解标识标签的作用,请查看此链接:

It would not be possible to access each labels Identity inspector > Identity > Label in your code. To better understand what the Identity label does, check out this link:

身份检查器中的标签属性

如果您刚使用定义的IBOulet访问标签,可能会更好。如果你想尝试类似的东西你可以设置标签属性,如下所示:

It would probably be better if you just accessed the label using the defined IBOulet. If you want to try something that is similar you could just set the tag property like so:

label.tag = 1;

为每个标签指定一个唯一标签,您应该能够使用

Give each label a unique tag and you should be able to access it using

UILabel * label = [self.view viewWithTag:1];

这篇关于可以在代码中访问身份标签的值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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