UITableViewCells scrolling speed increases dramatically when you do custom开发者_运维百科 drawing, however, Accessibility breaks. How should one add accessibility support to a cell like this?
Old question, but iOS has built in support for this kind of accessibility. Take a look at the UIAccessibilityContainer
informal protocol which will allow you to define rects in your view and label them appropriately. Thus, if you draw a big X at 0,0 with a size of 44x44, then you can set the accessibilityLabel for that rect to "Delete".
You'll need to set the relevant accessibilityLabel yourself if you're using custom views to display information (in this case, to draw a table cell). Depending on exactly which view you've taken over drawing for, the label you need might be either the table cell's (for a UITableViewCell subclass) or your custom content view's.
If you're drawing complex information in your custom cells, consider including all that you can reasonably vocalise in the label, separated by commas as discussed in the accessibility guide. What to include is usually common sense but talking to a regular voiceover user can be really helpful, especially regarding what piece of information they want to know first.
I'm a bit in the dark as well on what you are trying to ask. To me, it sounds like you're having trouble accessing methods/objects on your custom cell. When you have a class named CustomCell
, use a line like
CustomCell *cell = (CustomCell *)[localTableView dequeueReusableCellWithIdentifier:MyIdentifier];
to create a custom cell.
Suppose your custom cell contains a few labels. You can then access them easily using something like
[cell.aLabel setText:@"Accessed by load"];
When you try to access methods, for example: an IBAction when pressed on a button inside a cell, you should declare those methods in your class CustomCell
(and not in your table view's class). After that, link your button's connector to the CustomCell's connector.
Note: this connector won't necessarily be in File's Owner. I'm using XCode 4, and I see 3 objects: File's Owner
, First Responder
, and Custom Cell
. My IBAction is located in Custom Cell
, even though I'm used to having it linked to File's Owner
.
I hope this was of any help.
精彩评论