SwiftUI Academy · บทเรียน

VoiceOver และป้ายกำกับการช่วยการเข้าถึง

อธิบายตัวควบคุมสำหรับเทคโนโลยีสิ่งอำนวยความสะดวก

บทเรียน 1 จาก 413 ขั้นตอน

VoiceOver และป้ายกำกับการช่วยการเข้าถึง เป็นบทเรียน SwiftUI Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน SwiftUI Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส SwiftUI Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

What Is VoiceOver?

VoiceOver is Apple's screen reader. It speaks your interface aloud so people who can't see the screen can still use your app. 🔊

SwiftUI Helps You

The good news: SwiftUI auto-generates accessibility for standard views. A Text already reads its content, so you start ahead.

When Labels Go Missing

An icon-only button has no readable text, so VoiceOver may say nothing useful. That's when you add an explicit accessibility label.

Button(action: save) {
    Image(systemName: "square.and.arrow.down")
}

Adding a Label

Attach accessibilityLabel to describe what a control does in plain words, not how it looks.

Button(action: save) {
    Image(systemName: "square.and.arrow.down")
}
.accessibilityLabel("Save")

Label, Not Appearance

Write the label as the user's goal. Say Save, not "down arrow icon". The label is meaning, never decoration.

Adding Hints

An accessibilityHint tells the user what happens after they act. It is read after the label, with a short pause.

.accessibilityLabel("Save")
.accessibilityHint("Saves your note to the list")

Reading the Value

For controls that hold data, accessibilityValue announces the current state, like a slider reading "70 percent".

Slider(value: $level)
    .accessibilityValue("\(Int(level)) percent")

Grouping Elements

Use accessibilityElement(children:) to merge a card's pieces into one swipe, so VoiceOver reads it as a single unit.

VStack { Text(name); Text(role) }
.accessibilityElement(children: .combine)

Marking Roles with Traits

Add accessibilityAddTraits so VoiceOver announces a view's role, like calling a tappable card a button.

.accessibilityAddTraits(.isButton)

Hiding Decoration

Purely decorative images add noise. Use accessibilityHidden(true) to skip them so VoiceOver focuses on what matters.

Image("sparkle")
    .accessibilityHidden(true)

Test It Yourself

Turn on VoiceOver in the Accessibility settings and swipe through your app. Hearing it is the fastest way to spot gaps.

Quick Check

You have an icon-only button. Which modifier gives VoiceOver a readable name?

Recap

You learned to make controls speak: add an accessibilityLabel for icons, hints for outcomes, and group or hide views so VoiceOver flows clearly. ✨

เริ่มต้นได้ฟรี

เรียนรู้ Swift ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
30
บทเรียน
120

คำถามที่พบบ่อย

บทเรียน “VoiceOver และป้ายกำกับการช่วยการเข้าถึง” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “VoiceOver และป้ายกำกับการช่วยการเข้าถึง” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส SwiftUI Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส SwiftUI Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “VoiceOver และป้ายกำกับการช่วยการเข้าถึง”

อธิบายตัวควบคุมสำหรับเทคโนโลยีสิ่งอำนวยความสะดวก คุณปฏิบัติ SwiftUI Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน SwiftUI Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน SwiftUI Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “VoiceOver และป้ายกำกับการช่วยการเข้าถึง” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน SwiftUI Academy นี้ได้ไหม

ได้ บทเรียน SwiftUI Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. VoiceOver และป้ายกำกับการช่วยการเข้าถึง
  2. ชนิดแบบไดนามิกและแบบอักษรปรับขนาด
  3. แปลสตริงและแค็ตตาล็อกสตริง
  4. ปรับให้เข้ากับโหมดสว่างและมืด
← กลับไปที่ SwiftUI Academy