2016-04-25 3 views
1

を却下しません:accessibilityPerformEscape私は<code>UIAlertContoller</code>を表示し、VoiceOverのユーザーがスクラブジェスチャを実行したときに、それを解任しようとしているUIAlertController

override func accessibilityPerformMagicTap() -> Bool { 
     showPopup() 
     return true 
    } 

    override func accessibilityPerformEscape() -> Bool { 
     print("close") 
     return true 
    } 

    func showPopup(){ 
     baseAlert = UIAlertController(title: "Popup", message: "Choose an option", preferredStyle: .Alert) 
     let firstAction = UIAlertAction(title: "method 1", style: .Default) { (alert: UIAlertAction!) -> Void in 
      print("one") 
     } 

     let secondAction = UIAlertAction(title: "method 2", style: .Default) { (alert: UIAlertAction!) -> Void in 
      print("two") 
     } 

     let thirdAction = UIAlertAction(title: "method 3", style: .Default) { (alert: UIAlertAction!) -> Void in 
      print("three") 
     } 

     let closeAction = UIAlertAction(title: "Close", style: .Destructive) { (alert: UIAlertAction!) -> Void in 
      print("close") 
      self.accessibilityPerformEscape() 
     } 

     baseAlert.addAction(firstAction) 
     baseAlert.addAction(secondAction) 
     baseAlert.addAction(thirdAction) 
      baseAlert.addAction(closeAction) 

     baseAlert.accessibilityHint = "Pop menu" 
     presentViewController(baseAlert, animated: true, completion: 
      { 
        self.textField.becomeFirstResponder() 
      } 
     ) 


    } 

上記のコードはUIAlertControllerを示し、私はスクラブジェスチャーを実行するとき、それは反応せずアラートが表示されない場合や却下された場合は、ジェスチャーのエスケープ処理が行われます。

答えて

0

accessibilityPerformEscape()にUIAlertControllerを終了するコードを追加する必要があります。trueでは不十分です。

関連する問題

 関連する問題