Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iosdc2018.pdf

 iosdc2018.pdf

iosdc2018でLTをしたときのアクセシビリティについての資料です。

[email protected]

September 01, 2018
Tweet

Other Decks in Programming

Transcript

  1. %ZOBNJD5ZQF4J[FT 4UZMF 8FJHIU Y4NBMM 4NBMM .FEJVN -BSHF Y-BSHF YY-BSHF YYY-BSHF

    -BSHF5JUMF 3FHVMBS        5JUMF 3FHVMBS        5JUMF 3FHVMBS        5JUMF 3FHVMBS        )FBEMJOF 4FNJ#PME        #PEZ 3FHVMBS        $BMMPVU 3FHVMBS        4VCIFBE 3FHVMBS        'PPUOPUF 3FHVMBS        $BQUJPO 3FHVMBS        $BQUJPO 3FHVMBS        ϑΥϯτ͸4BO'SBODJTDP
  2. -BSHFS"DDFTTJCJMJUZ5ZQF4J[FT 4UZMF 8FJHIU "9 "9 "9 "9 "9 -BSHF5JUMF 3FHVMBS

         5JUMF 3FHVMBS      5JUMF 3FHVMBS      5JUMF 3FHVMBS      )FBEMJOF 4FNJ#PME      #PEZ 3FHVMBS      $BMMPVU 3FHVMBS      4VCIFBE 3FHVMBS      'PPUOPUF 3FHVMBS      $BQUJPO 3FHVMBS      $BQUJPO 3FHVMBS      ϑΥϯτ͸4BO'SBODJTDP
  3. J04͔ΒΧελϜϑΥϯτʹ΋ରԠ 8FC7JFXͰ΋ར༻Մೳ QSJWBUFMFUDPOUFOU6*-BCFM  JGMFUGPOU6*'POU OBNF/PUFXPSUIZ TJ[F \ DPOUFOUGPOU6*'POU.FUSJDTEFGBVMUTDBMFE'POU GPSGPOU

    ^ DPOUFOUBEKVTUT'POU'PS$POUFOU4J[F$BUFHPSZUSVF CPEZ\ GPOUBQQMFTZTUFNCPEZ"QQMFσόΠεͷΈར༻Մೳ ^I\ GPOUTJ[FSFN ^
  4. override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { let isAccessibilityCategory = traitCollection.preferredContentSizeCategory.isAccessibilityCategory

    if isAccessibilityCategory != previousTraitCollection?.preferredContentSizeCategory.isAccessibilityCategory { updateLayoutContraints() } } ΞΫηγϏϦςΟͷઃఆΛΩϟονͰ͖Δ จࣈαΠζͷઃఆʹ߹ΘͤͯશͯͷཁૉΛਨ௚ʹϨΠΞ΢τ
  5. MFUNBSHJO$('MPBU PWFSSJEFGVODTJ[F5IBU'JUT @TJ[F$(4J[F $(4J[F\ MFUVTFS4J[FVTFS/BNFTJ[F5IBU'JUT $(4J[F XJEUITFMGDPOUFOU7JFXCPVOETXJEUI IFJHIUHSFBUFTU'JOJUF.BHOJUVEF MFUEBUF4J[FEBUFTJ[F5IBU'JUT $(4J[F

    XJEUITFMGDPOUFOU7JFXCPVOETXJEUI IFJHIUHSFBUFTU'JOJUF.BHOJUVEF MFUDPOUFOU4J[FDPOUFOUTJ[F5IBU'JUT $(4J[F XJEUITFMGDPOUFOU7JFXCPVOETXJEUI IFJHIUHSFBUFTU'JOJUF.BHOJUVEF SFUVSO$(4J[F XJEUITFMGDPOUFOU7JFXCPVOETXJEUI IFJHIUVTFS4J[FIFJHIU EBUF4J[FIFJHIU DPOUFOU4J[FIFJHIU NBSHJO  ^ TJ[F5IBU'JUTΛPWFSSJEFͯ͠ߴ͞Λઃఆ DPOUFOU7JFXCPVOETTJ[FXJEUIͰԣ෯Λऔಘ "VUP-BZPVUΛ࢖༻͍ͯ͠ͳ͍৔߹
  6. private var backButton = UIButton() backButton.accessibilityTraits = UIAccessibilityTraitButton backButton.accessibilityLabel =

    "໭Δ" backButton.accessibilityValue = "" backButton.accessibilityHint = “લͷը໘ʹ໭Γ·͢ɻ"
  7. 6*7JFXʹઃఆ 6*"DDFTTJCJMJUZ&MFNFOU ͱͯ͠௥Ճ private var elements: [UIAccessibilityElement] = [] private

    func setAccessibility(x: CGFloat, y: CGFloat, title: String, text: String) { let frame = CGRect(x: x, y: y, width: barWidth, height: bounds.height - y) let element = UIAccessibilityElement(accessibilityContainer: self) element.accessibilityLabel = title element.accessibilityValue = text element.accessibilityFrameInContainerSpace = frame elements.append(element) } self.accessibilityElements = elements ΧελϜϏϡʔʹ΋ରԠՄೳ GSBNFͰదԠൣғΛࢦఆ ˞6*7JFXͷதͷઃఆͰ͢ɻ
  8. customView.accessibilityCustomActions = [ UIAccessibilityCustomAction( name: “Call", target: self, selector: #selector(activateCallButton)

    ), UIAccessibilityCustomAction( name: "Open address in Maps”, target: self, selector: #selector(activateLocationButton) ) ] 7PJDF0WFSݶఆͷΞΫγϣϯΛઃఆ UIAccessibility.post(notification: .screenChanged, argument: nil) 7PJDF0WFS΁มߋΛ௨஌ ϑΥʔΧεͷҠಈͳͲͷͨΊ