Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

301
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!