2009-12-03 64 views

回答

1

您可以使用一個的UILabel與自己設置的子視圖另外兩個UILabels。水木清華這樣

UILabel* mainLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 120, 40)]; 
UILabel* firstSublabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 60, 40)]; 
[firstSublabel setText:@"asd"]; 
[firstSublabel setTextColor:[UIColor redColor]]; 
[mainLabel addSubview:firstSublabel]; 
[firstSublabel release]; 
UILabel* secondSublabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 60, 60, 40)]; 
[secondSublabel setText:@"dfg"]; 
[secondSublabel setTextColor:[UIColor greenColor]]; 
[mainLabel addSubview:secondSublabel]; 
[secondSublabel release]; 
[self.view addSubview:mainLabel]; 
[mainLabel release]; 
+0

你會給任何教程鏈接請問? – 2009-12-03 11:44:23