我有一个UIButton.它有两个子视图.然后我打电话给:
[createButton addTarget:self action:@selector(openComposer) forControlEvents:UIControlEventTouchUpInside];
Run Code Online (Sandbox Code Playgroud)
如果我点击UIButton那些未被覆盖的部分,但是它的一个子视图,它可以正常工作.但是,如果我点击其中一个子视图,则不会触发该操作.
在两个子视图中,我已经.userInteractionEnabled设置为YES.
这两个子视图都是UIViews带有frame和的backgroundColor.
如何让水龙头"通过" UIView并进入UIButton?
谢谢
编辑:我需要使用UIControlEvents因为我需要UIControlEventTouchDown.
编辑2:
这是按钮的代码.
@interface CreateButton ()
@property (nonatomic) Theme *theme;
@property (nonatomic) UIView *verticle;
@property (nonatomic) UIView *horizontal;
@property (nonatomic) BOOL mini;
@end
@implementation CreateButton
#pragma mark - Accessors
- (UIView *)verticle {
if (! _verticle) {
_verticle = [[UIView alloc] init];
_verticle.backgroundColor = [self.theme colorForKey:@"createButtonPlusBackgroundColor"];
_verticle.userInteractionEnabled = NO;
}
return …Run Code Online (Sandbox Code Playgroud)