2016-12-09 6 views

答えて

3

私は周りを狩りをした後、私はアクセシビリティの特性が設定されていないことに気づいた。たとえば、私は次のクラスを持っています。

class ActivityButton: UIControl { 

    private let activityIndicator: UIActivityIndicatorView = { 
     let activityIndicator = UIActivityIndicatorView() 
     activityIndicator.hidesWhenStopped = true 
     activityIndicator.translatesAutoresizingMaskIntoConstraints = false 
     return activityIndicator 
    }() 

    let titleLabel: UILabel = { 
     let titleLabel = UILabel() 
     titleLabel.translatesAutoresizingMaskIntoConstraints = false 
     return titleLabel 
    }() 

    override public init(frame: CGRect) { 
     super.init(frame: frame) 
     // This is the required call to make the control appear 
     // as a button in ui tests 
     accessibilityTraits = UIAccessibilityTraitButton 
     addSubview(activityIndicator) 
     addSubview(titleLabel) 
     createConstraints() 
    }  

} 
関連する問題