2010-06-23 3 views

답변

0

가장 간단한 방법은 UIImageView를 UILabel 뒤에 레이어하는 것입니다. 좀 더 강력하게 만들고 싶다면 이미지 배경을 설정하는 메서드 나 속성을 제공하는 UILabel 하위 클래스를 만들어 이미지 자체를 추가 할 수 있습니다.

CGPoint labelPos = CGPointMake(123, 234); 
UIImage *theImage = [UIImage imageNamed:@"button_bg.png"]; 
UIImageView *theImageView = [[UIImageView alloc] initWithImage:theImage]; 
theImageView.frame = CGRectMake(labelPos.x, labelPos.y, theImage.size.width, theImage.size.height); 
UILabel *theLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelPos.x, labelPos.y, 100, 50)]; 
theLabel.backgroundColor = [UIColor clearColor]; 
// ...label config... 

[self.view addSubview:theImageView]; 
[self.view addSubview:theLabel]; 

[theImageView release]; 
[theLabel release]; 
관련 문제