简体   繁体   English

NSAffineTransform在Mac OS X 10.11中是否具有不同的坐标系?

[英]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: 我的项目在Mac OSX 10.10 / 10.9上运行良好,但是在10.11中使用以下代码无法正确运行:

[(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]; 当我更改此设置时[translate translationXBy:-bound.origin.x yBy:-bound.origin.y];

to

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

The application works correctly on OSX 10.11, but incorrectly on OSX 10.10/10.9... 该应用程序可以在OSX 10.11上正常运行,但是不能在OSX 10.10 / 10.9上正常运行...

I don't know why, Does NSAffineTransform have different Coordinate system in latest Mac OS X 10.11? 我不知道为什么,NSAffineTransform在最新的Mac OS X 10.11中是否具有不同的坐标系? How can I solve this to make the application compatible with both 10.10/9 and 10.11? 如何解决此问题,以使应用程序与10.10 / 9和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. 在他们再次改变主意(或修复错误)之前,我正在检查系统版本(使用/System/Library/CoreServices/SystemVersion.plist中的ProductVersion密钥),并使用10.10及更早版本的旧方法以及新方法原产地为10.11及更高版本的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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