Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在操作方法中通过其标签检测 Button sender 后,我想使用某种临时 UILabel var 将一些文本动态分配给相应的 Label(例如 button tag+10 )。
希望这是可以理解的?..英语不是我的母语:)
谢谢你。
在包含视图中,您可以使用 viewWithTag 来获取具有特定标签的对象。
如果您知道该对象是 UILabel,则可以对其进行类型转换以获取您的标签对象。
如果您在 viewcontroller.m 文件中:
UILabel* myLabel; myLabel = (UILabel*)[self.view viewWithTag:(buttonTag+10)];
祝你好运!