0
런타임에 새 UIButton을 만들고 titleLabel의 텍스트를 설정 한 후에도 버튼의 텍스트는 계속 표시되지 않습니다.UIButton의 titleLabel.text가 Cocoa Touch에 표시되지 않습니다.
내가 뭘 잘못하고 있니?
-(IBAction) cloneMe: (id) sender{
if (!currentY) {
currentY = [sender frame].origin.y;
}
UIButton *clone = [UIButton buttonWithType:UIButtonTypeRoundedRect];
CGRect cloneFrame = [sender frame];
cloneFrame.origin.y += currentY + cloneFrame.size.height + 30;
clone.frame = cloneFrame;
[clone titleLabel].text = @"I'm a clone";
[[sender superview] addSubview:clone];
currentY = cloneFrame.origin.y + cloneFrame.size.height;
}
복제 된 버튼 자체가 표시됩니까? – Ryan
예, 표시되지 않는 텍스트 일뿐입니다. – cfischer