0

我想在 iPod Touch 应用程序的同一个视图上使用两个标签。我已经创建了这两个标签,但我只知道如何访问它们。有没有人有如何做到这一点的例子?

4

1 回答 1

0
UILabel *label1 = [[UILabel alloc] initwithFrame: CGRectMake(0,0,100,100)];
UILabel *label2 = [[UILabel alloc] initwithFrame: CGRectMake(0,0,200,200)];

label1.text = @"Label One";
label2.text = @"Label Two";

或者,如果您在 Interface builder 中创建了标签,请确保您IBOutlet对它们都有 s 以便从您的代码中访问它们。

于 2009-11-18T18:22:26.230 回答