Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

320
Visualizações
Make VoiceOver say "Swipe Up or Down to Select a Custom Action, then double tap to activate"

I have a UITextView with two different hyperlinks in it. To give the chance to choose between the two links when VoiceOver is on, I did:

class MyTextView {
   override func awakeFromNib() {
       super.awakeFromNib()
       let str = "xxxxxx Option 1 yyyy Option 2"
       let attrStr = NSMutableAttributedString(str)
       let rangeOption1 = (str as NSString).range(of: "Option 1")
       let rangeOption2 = (str as NSString).range(of: "Option 2")
       attrStr.addAttributes([.link: "option1", range: rangeOption1])
       attrStr.addAttributes([.link: "option2", range: rangeOption2])

       self.attributedText = attrStr
   }

   override var isAccessibilityElement: Bool {
       get { return true }
       set {}
   }

   override var accessibilityLabel: String? {
       get { return "Link Options" }
       set {}
   }

   override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
       get {
           return [
                UIAccessibilityCustomAction(name: "Choose Option One", target: self, selector: #selector(option1)),
                UIAccessibilityCustomAction(name: "Choose Option Two", target: self, selector: #selector(option2))]
       }
       set {}
   }

   @objc func option1() { print ("Option 1") }
   @objc func option2() { print ("Option 2") }
}

I did this following this WWDC video from min 33. What I can not manage is that it says Swipe Up or Down to Select a Custom Action, then double tap to activate when the textView is focused.

Right now it says "xxxxxx Option 1 [pause] link [pause] yyyy Option 2 [pause] link [pause]"

Once the textView is focused, if I swipe down on it it tells me the "Choose Option One" and "Choose Option Two". If after it says "Choose Option X" I double tap, the correction option is chosen.

Technically all is good, I just want to to announce the instructions to the user as it does in the video. Worst case scenario I will just append that to the accessibilityLabel, but that's hacky.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

  • When accessibilityCustomActions is set, OS announce "Actions Available. Swipe Up or Down to Select a Custom Action, then double tap to activate"
  • You can set the accessibilityHint to provide a custom message.
over 4 years ago · Santiago Trujillo Relatório

0

I may be wrong but actions can't be read out as you mentioned, just adjustable values can.

I followed the content of this video thanks to this detailed summary and I heard :

  • "Adjustable, swipe up or down with one finger to adjust the value" for the adjustable element : video.
  • "Actions available" only when the element with custom actions is selected : video.

"Actions available" is only read out with actions as you implemented, you cannot have anything else natively.

If I'm wrong, please let me know the timelapse of the WWDC video you heard what you mentioned, please ?

Now, if you need further information with the .adjustable trait, including illustrations and code snippets (ObjC + Swift), I suggest you take a look at this site.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda