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.
是否有机会将对象行为复制到另一个对象?
例如,我有一个标签“labelx”,设置字体大小 = 12,颜色 = 蓝色 现在我想将此设置传递给另一个标签“y”。
提前致谢!
label2.font = label1.font; label2.textColor = label1.textColor;
如果您有很多此类标签,则将它们添加到数组中并在枚举循环中“复制”属性是有意义的。
您可能想看看这个答案- 它显示了一种深度复制标签的方法。