How do I make a CALayer accessible? Specifically, I want the layer to be able to change its label on the fly, since it can change at any time. The official documentation's sample code does not really allow for this.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- Custom UITableview cell accessibility not working
- iOS (objective-c) compression_decode_buffer() retu
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
- Why is my library not able to expand on the CocoaP
The following assumes that you have a superview whose layers are all of class
AccessableLayer
, but if you have a more complex layout this scheme can be modified to handle that.In order to make a
CALayer
accessible, you need a parent view that implements theUIAccessibilityContainer
methods. Here is one suggested way to do this.First, have each layer own its
UIAccessibilityElement
now in its implementation, you modify the element whenever it changes:
The AccessableLayer never creates the
UIAccessibilityElement
, because the constructor requires a UIAccessibilityContainer. So have the super view create and assign it: