Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set accessibilityIgnoresInvertColors on image views #273

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changes for users of the library currently on `develop`:
- Fixed some tests, added tests for NYTPhotoViewerSinglePhotoDataSource
- Fixed a strict warning and a subscripting bug in NYTPhotoViewerArrayDataSource.m
- Added support for interstitial views
- Set `accessibilityIgnoresInvertColors = true` on image views

## [2.0.0](https://github.com/NYTimes/NYTPhotoViewer/releases/tag/2.0.0)

Expand Down
4 changes: 4 additions & 0 deletions Example-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

if #available(iOS 11.0, *) {
imageButton?.accessibilityIgnoresInvertColors = true
}

let buttonImage = UIImage(named: ReferencePhotoName)
imageButton?.setBackgroundImage(buttonImage, for: UIControlState())
}
Expand Down
8 changes: 8 additions & 0 deletions Example/NYTViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ @interface NYTViewController () <NYTPhotosViewControllerDelegate>

@implementation NYTViewController

- (void)viewDidLoad {
[super viewDidLoad];

if (@available(iOS 11.0, *)) {
self.imageButton.accessibilityIgnoresInvertColors = YES;
}
}

- (IBAction)imageButtonTapped:(id)sender {
self.dataSource = [self.class newTimesBuildingDataSource];

Expand Down
5 changes: 5 additions & 0 deletions NYTPhotoViewer/NYTPhotoTransitionAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ - (void)performZoomingAnimationWithTransitionContext:(id <UIViewControllerContex
if (!endingViewForAnimation) {
endingViewForAnimation = [[self class] newAnimationViewFromView:self.endingView];
}

if (@available(iOS 11.0, *)) {
startingViewForAnimation.accessibilityIgnoresInvertColors = YES;
endingViewForAnimation.accessibilityIgnoresInvertColors = YES;
}

CGAffineTransform finalEndingViewTransform = self.endingView.transform;

Expand Down
3 changes: 3 additions & 0 deletions NYTPhotoViewer/NYTScalingImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ - (void)setupInternalImageViewWithImage:(UIImage *)image imageData:(NSData *)ima
#else
self.imageView = [[UIImageView alloc] initWithImage:imageToUse];
#endif
if (@available(iOS 11.0, *)) {
self.imageView.accessibilityIgnoresInvertColors = YES;
}
[self updateImage:imageToUse imageData:imageData];

[self addSubview:self.imageView];
Expand Down