I'm finding a lot of questions here which are about int开发者_开发技巧ercepting touch events and making sure they don't arrive at some superview. My problem is the other way around.
I'm having this custom UIButton
subclass which has a number of UILabels
, a UIProgressView
, and a custom UIView
subclass as its subviews. These subviews should be 'transparent' with regards to user interaction, in other words they should pass the touch events to my UIButton
subclass.
Based on the documentation, I feel that the default behavior actually works this way: the frontmost view receives a touch event, and subsequently passes the event to the underlying views (traversing down the responder chain).
However, the UIProgressView
I added to my UIButton
does block touch events. The only code with respect to the UIProgressView
I've written is this:
progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(16, 98, 108, 10)];
progressView.progressViewStyle = UIProgressViewStyleBar;
progressView.progress = 0.;
[self addSubview:progressView];
[progressView release];
So nothing fancy. My custom UIView
does not pass the touch events to my UIButton
either. What's wrong?
精彩评论