Log4j2: конфигурация с другим уровнем журнала в зависимости от системного свойства

Обнаружение касания внутри пути безье в быстром: -

Это просто в последнем быстром, выполните следующие действия, и вы получите событие касания UIBezierPath.

Шаг 1: - Инициализировать Нажмите Событие на просмотр, где добавлен ваш UIBeizerPath.

///Catch layer by tap detection let tapRecognizer:UITapGestureRecognizer = UITapGestureRecognizer.init(target: self, action: #selector(YourClass.tapDetected(_:))) viewSlices.addGestureRecognizer(tapRecognizer)

Шаг 2: - Сделайте метод «tapDetected»

  //MARK:- Hit TAP
public func tapDetected(tapRecognizer:UITapGestureRecognizer){
    let tapLocation:CGPoint = tapRecognizer.locationInView(viewSlices)
    self.hitTest(CGPointMake(tapLocation.x, tapLocation.y))


}

Шаг 3: - Сделайте окончательный метод «hitTest»

  public func hitTest(tapLocation:CGPoint){
        let path:UIBezierPath = yourPath
        if path.containsPoint(tapLocation){
            //tap detected do what ever you want ..;)
        }else{
             //ooops you taped on other position in view
        }
    }

Обновление: Swift 4

Шаг 1: - Инициализировать событие Tap на экране, где добавлен ваш UIBeizerPath.

///Catch layer by tap detection
let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(YourClass.tapDetected(tapRecognizer:)))
viewSlices.addGestureRecognizer(tapRecognizer)

Шаг 2: - Сделайте метод «tapDetected»

public func tapDetected(tapRecognizer:UITapGestureRecognizer){
    let tapLocation:CGPoint = tapRecognizer.location(in: viewSlices)
    self.hitTest(tapLocation: CGPoint(x: tapLocation.x, y: tapLocation.y))
}

Шаг 3: - Сделайте окончательный метод «hitTest»

private func hitTest(tapLocation:CGPoint){
    let path:UIBezierPath = yourPath

    if path.contains(tapLocation){
        //tap detected do what ever you want ..;)
    }else{
        //ooops you taped on other position in view
    }
}
0
задан Jdv 20 February 2019 в 15:22
поделиться

0 ответов

Другие вопросы по тегам:

Похожие вопросы: