How to check if the Button Shapes setting is enabled?

As of iOS 14, you can use UIAccessibility.buttonShapesEnabled or UIAccessibilityButtonShapesEnabled(), which will be true when the setting is enabled.


Old question, but hopefully this helps someone. There's still no built-in method for checking if Button Shapes is enabled on iOS, so we added this:

#pragma mark - Accessibility

/**
 * There's currently no built-in way to ascertain whether button shapes is enabled.
 * But we want to manually add shapes to certain buttons when it is.
 */

static BOOL _accessibilityButtonShapesEnabled = NO;

+ (BOOL)accessibilityButtonShapesEnabled {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [self checkIfButtonShapesEnabled];
    });

    return _accessibilityButtonShapesEnabled;
}

+ (void)checkIfButtonShapesEnabled {
    UIButton *testButton = [[UIButton alloc] init];
    [testButton setTitle:@"Button Shapes" forState:UIControlStateNormal];

    _accessibilityButtonShapesEnabled = (BOOL)[(NSDictionary *)[testButton.titleLabel.attributedText attributesAtIndex:0 effectiveRange:nil] valueForKey:NSUnderlineStyleAttributeName];
}

Because there's also no notification if Button Shapes is disabled/enabled whilst the app is running, we run checkIfButtonShapesEnabled in applicationDidBecomeActive:, and push our own notification if the value has changed. This should work in all cases, because it is not currently possible to add the Button Shapes toggle to the "Accessibility Shortcut".