UIButton 프레임 설정과 관련하여 문제가 있습니다.UIButton의 프레임을 UILabel의 특정 단어로 설정하십시오.
NSString *sample = @"Demo to set display view on label in iPhone";
CGSize maximumLabelSize = CGSizeMake(55,9999);
expectedLabelSize = [sample sizeWithFont:[UIFont systemFontOfSize:20]
constrainedToSize:maximumLabelSize
lineBreakMode:UILineBreakModeWordWrap];
NSLog(@"%f",expectedLabelSize.height);
self.label = [[UILabel alloc] initWithFrame:CGRectMake(50, 50, expectedLabelSize.width, expectedLabelSize.height)];
self.label.backgroundColor = [UIColor clearColor];
self.label.numberOfLines = 0;
self.label.text = sample;
[self.label sizeToFit];
아래의 uibutton 코드에서 "iPhone"단어 만 클릭 할 수 있도록 텍스트의 프레임 위치를 설정하는 방법은 무엇입니까?
self.button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
self.button.frame = CGRectMake(self.label.frame.origin.x,
self.label.frame.origin.y+50,
expectedLabelSize.width,
expectedLabelSize.height);
이 버튼이 자동으로 라벨 위에 표시되도록 하시겠습니까? –
나는 uilabel의 iPhone text만을 클릭하고 싶다. 어떤 생각이든 –
아, UIButton이 UILabel에 텍스트 "iPhone"이있는 곳이되기를 원합니 까? 그것은 여러 줄로 된 레이블로는 어려움이 있습니다. 텍스트 "iPhone"을 UIButton에만 넣고 UILabel에 넣지 않는 것이 좋습니다. – progrmr