Hi, i used
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 180, 180)];
myLabel.backgroundColor = [UIColor greenColor];
[self.view addSubview:myLabel];
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[self addTarget:self action:@selector(show) forControlEvents:UIControlEventTouchDown];
myButton.frame = CGRectMake(80.0, 120.0, 30, 30);
myButton.showsTouchWhenHighlighted = YES;
[self addSubview:myButton];
in this way the button works(call show:), but use [myLabel addSubview:myButton]; the button can't work. who can tell me why? I have tried to change the target to myLabel, can't work too.So who can tell me,thank you.
By the way , i want to use the button on the UILabel,and the UILabel on UIScrollView.Thanks a lot!