UIButton未收到点击。

所以这是我的代码:
    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。 有任何想法吗?     
已邀请:
我希望,您可以在另一个大按钮上添加一个小按钮...要实现此目的,您可以添加 一个svView上的UIView(例如buttonView)具有较大的按钮框架大小,之后可以在buttonView(UIview)上添加两个按钮。
            [svObjectButton addSubview:removeButton];
    
为什么removeButton必须是svObjectButton的子视图? 我认为问题在于UIButton是UIButton的子视图。尝试将removeButton添加到svView中。     

要回复问题请先登录注册