/ / कैसे नेविगेशन नियंत्रक वापस स्वाइप जेस्चर प्रतिक्रिया क्षेत्र को बढ़ाने के लिए? - इओस

नेविगेशन नियंत्रक को कैसे बढ़ाएं इशारा प्रतिक्रिया क्षेत्र स्वाइप करें? - आईओएस

मैंने पाया कि नेविगेशन कंट्रोलर का उपयोग करते हुए, डिफ़ॉल्ट बैक स्वाइप जेस्चर तब पेश किया जाएगा जब उपयोगकर्ता स्क्रीन के बाईं ओर से स्वाइप करेगा, जो ऐप को पिछले दृश्य पर वापस जाएगा।

क्या स्क्रीन के बाईं ओर से शुरू होने के अलावा स्क्रीन पर किसी भी बिंदु से शुरू करने का एक तरीका है?

धन्यवाद।

उत्तर:

जवाब के लिए 0 № 1

बस अपने खुद के हावभाव पहचानकर्ता को जोड़ें और इशारों के लिए देखें कि x दिशा में वेग अधिक है और बाएं से दाएं जा रहा है।

    override func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {

if (gestureRecognizer.isMemberOfClass(UIPanGestureRecognizer)){
let point:CGPoint = (gestureRecognizer as UIPanGestureRecognizer).velocityInView(self)
if (abs(point.x) > abs(point.y)){
return true
}
}
}

यहाँ पर इशारा संभालें:

func handlePanGestureRecognizer(gesture: UIPanGestureRecognizer){
let translation:CGPoint = gesture.translationInView(self)
if(translation.x > 0){
//its going from left to right...
//...Do stuff over here to handle the gesture, for eg. push the view from the stack
}


}