런타임에 UIControl을 만들고 뷰에 addSubview :)를 추가하면 뷰에서이를 해제 할 것인가, 아니면 그렇게해야할까요? 당신은 수신기가 인수를 유지 addSubview:
, 당신이하는 방법 중 하나를 통해 제거 릴리스를 할 때UIView는 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 setTitle:@"I'm a clone" forState:UIControlStateNormal];
[[sender superview] addSubview:clone];
currentY = cloneFrame.origin.y + cloneFrame.size.height;
}
코드의 간단한 예를 제공해 주시겠습니까? – DerekH
위의 샘플 코드를 참조하십시오. – cfischer