Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[iOS] AutomationProperty support for cells #3313

Merged
merged 2 commits into from
Aug 23, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Xamarin.Forms.Platform.iOS/Cells/CellRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,30 @@ public virtual UITableViewCell GetCell(Cell item, UITableViewCell reusableCell,

UpdateBackground(tvc, item);

SetAccessibility (tvc, item);

Performance.Stop(reference);
return tvc;
}

public virtual void SetAccessibility (UITableViewCell tableViewCell, Cell cell)
{
if (cell.IsSet (AutomationProperties.IsInAccessibleTreeProperty))
tableViewCell.IsAccessibilityElement = cell.GetValue (AutomationProperties.IsInAccessibleTreeProperty).Equals (true);
else
tableViewCell.IsAccessibilityElement = false;

if (cell.IsSet (AutomationProperties.NameProperty))
tableViewCell.AccessibilityLabel = cell.GetValue (AutomationProperties.NameProperty).ToString ();
else
tableViewCell.AccessibilityLabel = null;

if (cell.IsSet (AutomationProperties.HelpTextProperty))
tableViewCell.AccessibilityHint = cell.GetValue (AutomationProperties.HelpTextProperty).ToString ();
else
tableViewCell.AccessibilityHint = null;
}

public virtual void SetBackgroundColor(UITableViewCell tableViewCell, Cell cell, UIColor color)
{
tableViewCell.BackgroundColor = color;
Expand Down
2 changes: 2 additions & 0 deletions Xamarin.Forms.Platform.iOS/Cells/TextCellRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell,

UpdateBackground(tvc, item);

SetAccessibility(tvc, item);

return tvc;
}

Expand Down