पर संपर्क पास करना मुझे यकीन है कि इस समस्या को आसानी से हल किया जाएगा हालांकि मैं आईओएस विकास के लिए अपेक्षाकृत नया हूं। मैं UIView पर ड्रॉ ऑर्डर में कम बच्चों के लिए गुजरने वाली स्पर्श घटनाओं को संभालने की कोशिश कर रहा हूं। उदाहरण के लिए -अगले उत्तरदाता या अन्य उप-दृश्य आईओएस
मैं अपने मूवबल इमेज क्लास को बनाने के लिए विस्तारित UIImageView बनाता हूं। इस वर्ग के सिर्फ मूल रूप से UIImageView कि touchesBegan, touchesEnded और touchesMoved-
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self showFrame];
//if multitouch dont move
if([[event allTouches]count] > 1)
{
return;
}
UITouch *touch = [[event touchesForView:self] anyObject ];
// Animate the first touch
CGPoint colorPoint = [touch locationInView:self];
CGPoint touchPoint = [touch locationInView:self.superview];
//if color is alpha of 0 , they are touching the frame and bubble to next responder
UIColor *color = [self colorOfPoint:colorPoint];
[color getRed:NULL green:NULL blue:NULL alpha:&touchBeganAlpha];
NSLog(@"alpha : %f",touchBeganAlpha);
if(touchBeganAlpha > 0)
{
[self animateFirstTouchAtPoint:touchPoint];
}
else {
[super.nextResponder touchesBegan:touches withEvent:event];
}
}
लागू करता है तो अंतिम परिणाम मूल रूप से इस-है वे अन्य छवि है कि हो जाएगा अंदर imageView के फ्रेम और नहीं छवि को छू रहे हैं, तो नीचे संभवतः जवाब दे सकते हैं। उदाहरण के लिए इस छवि को देखें।
अब तक मैं कोशिश की है अगले प्रत्युत्तर लेकिन इस समस्या का समाधान नहीं है। किसी भी तरह की सहायता का स्वागत किया जाएगा!
हल हुआ- मैंने स्पर्शों पर अल्फा की जांच करना बंद कर दिया और स्पर्श किया। Ovveriding बिंदु इनसाइड ने UIView को मेरे लिए इसे संभालने की अनुमति दी।
-(BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *) event
{
BOOL superResult = [super pointInside:point withEvent:event];
if(!superResult)
{
return superResult;
}
if(CGPointEqualToPoint(point, self.previousTouchPoint))
{
return self.previousTouchHitTestResponse;
}else{
self.previousTouchPoint = point;
}
BOOL response = NO;
//if image is nil then return yes and fall back to super
if(self.image == nil)
{
response = YES;
}
response = [self isAlphaVisibleAtPoint:point];
self.previousTouchHitTestResponse = response;
return response;
}
महान धन्यवाद आदमी काम किया! – thebringking