【发布时间】:2011-04-17 20:51:10
【问题描述】:
所以这是我的代码:
UIButton *svObjectButton = [UIButton buttonWithType:UIButtonTypeCustom];
svObjectButton.frame = CGRectMake(0, 0, 100, 100);
[svObjectButton addTarget:self action:@selector(svObjectTouchUpInside) forControlEvents:UIControlEventTouchUpInside];
[svView addSubview:svObjectButton];
UIButton *removeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
removeButton.frame = CGRectMake(0, 0, 20, 20);
[removeButton addTarget:self action:@selector(removeButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[svObjectButton addSubview:removeButton];
[svObjectButton bringSubviewToFront:removeButton];
但由于某种原因,所有对 removeButton 的操作都会直接传递到 svObjectButton。
有什么想法吗?
【问题讨论】:
标签: iphone objective-c cocoa-touch uibutton