简体   繁体   中英

Does NSAffineTransform have different Coordinate system in Mac OS X 10.11?

My project works well on Mac OSX 10.10/10.9, however it works incorrectly in 10.11 with this code:

[(PDFAnnotationInk*)_activeAnnotation removeBezierPath:_path];

[_activeAnnotation setBounds:bound];                           

// Lazy, redraw entire view.        

 NSAffineTransform* transform = [NSAffineTransform transform]; 

[transform translateXBy:-bound.origin.x yBy:-bound.origin.y];

 [_path transformUsingAffineTransform:transform];

[(PDFAnnotationInk*)_activeAnnotation addBezierPath:_path]; 

[[_activeAnnotation page] removeAnnotation: _activeAnnotation];     

[self addAnnotationSelector:_activeAnnotation];

When I change this [transform translateXBy:-bound.origin.x yBy:-bound.origin.y];

to

[transform translateXBy:bound.origin.x yBy:bound.origin.y];

The application works correctly on OSX 10.11, but incorrectly on OSX 10.10/10.9...

I don't know why, Does NSAffineTransform have different Coordinate system in latest Mac OS X 10.11? How can I solve this to make the application compatible with both 10.10/9 and 10.11? Thanks.

I had the same problem. The rules for how to position annotations are not documented; nowhere does it say that ink paths have to be relative to the origin of the annotation, but they do. I assume that someone at Apple either broke it accidentally or changed their minds about how it should work.

Until they change their minds again (or fix the bug), I am checking the system version (using the ProductVersion key in /System/Library/CoreServices/SystemVersion.plist) and doing it the old way for 10.10 and earlier, and the new way with non-inverted origin for 10.11 and later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM