如何在 MacOSX 上更改 ObjC 方法的默认/首选项?
MacOSX 10.6 有一个方法 setWantsRestingTouches,默认值为“否”,但我想以某种方式将默认值更改为“是”。 (否则,我必须要求我使用的每个应用程序的开发人员将其设置为可设置的首选项,并相应地调用该方法。)
是否有一些传统的方法可以将方法名称转换为全局首选项?
虽然许多应用程序公开了可以通过“defaults write ...”shell 命令设置的用户首选项,但除了 Apple 提供的各种方法之外,是否有类似的东西?
(抱歉,我还不是 ObjC 编码员,所以我可能对问题的措辞不正确。)
具体来说,我有兴趣重新引入触控板选项以禁用“忽略意外触控板输入”,该选项在 10.5.x 后期就消失了当一体式 MacBook 推出时。开发人员文档指出 NSTouch 类的 setWantsRestingTouches 方法和 isResting 属性是在特定于应用程序的级别上解决此行为的挂钩。我的目标是比这更深层次。
谢谢!
MacOSX 10.6 has a method setWantsRestingTouches with a default of No, but I'd like to somehow change the default to YES. (Otherwise, I'd have to request developers of each app I use to make this a settable preference and invoke that method accordingly.)
Is there some conventional way to translate from a method name to a global preference?
While many apps expose user preferences that may be set via 'defaults write ...' shell command, is there something similar but for the various methods provided by Apple?
(Apologies for not being an ObjC coder yet, so I'm likely phrasing the questions improperly.)
Specifically, I'm interested in re-introducing the trackpad option to DISABLE "Ignore accidental trackpad input" that went away late into 10.5.x when unibody macbooks were introduced. The developer docs indicate that setWantsRestingTouches method and isResting property of NSTouch class are the hooks for resolving this behavior on an app-specific level. I'm aiming for a deeper level than that.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。
此外,不幸的是,
wantsRestingTouches
甚至不是应用程序级别的首选项。这是视图级别的首选项。视图是您在窗口内看到的各种组件;许多对象本身就是视图,并且每个对象都有wantsRestingTouches
设置。因此,开发人员也不能轻松地将
wantsRestingTouches
全局更改为YES
。 (从某种意义上说你可以,但你并不是真的想这样做。)你真的确定你想这样做吗?对于严酷的苹果来说,如果母舰认为这是一个好方法,那么有时放弃并接受它是一个好方法。 (在这种情况下,取消这个特定的选项。) 每次 OS X 更新,一些功能被抛弃,很多人流泪,很多人大声抱怨,但通常这并没有改变霸主的想法。随着每个版本的 OS X 都封锁了许多门,入侵系统变得越来越困难。但几年后,人们最终会习惯新系统。
也就是说,有一种方法可以做到这一点,但这涉及很多步骤。
init 的代码
方法,以便它NSView
的setWantsRestingTouches:YES
osax
技巧注入它,请参阅此处。它周围有一个名为 SIMBL 的包装器,我不会为您编写一个。相反,如果您真的非常想要这样做,那么这是一个学习 OS X 和 Objective-C 深层技巧的好机会。所以,要有耐心,愿意学习并享受乐趣!
No.
Furthermore, the
wantsRestingTouches
is not even an app-level preference, unfortunately. It's a view-level preference. Views are the various components you see inside a window; many objects are themselves views, and each of them haswantsRestingTouches
setting.So it's not that a developer can easily turn
wantsRestingTouches
toYES
globally, either. (Well in a sense you can, but you don't really want to do that.)Are you really sure you want to do that? With draconian Apple, it's sometimes a good approach to just give up and live with it if the mothership thinks it's a good way. (In this case, doing away with this particular option.) With each OS X update, some features were thrown out, and many people shed tears and many loudly complained, but usually it didn't change the overlord's mind. And hacking a system becomes more and more difficult as each version of OS X locks down many doors. But in a few years, people eventually get used to the new system.
That said, there's a way to do that, but that involves a lot of steps.
init
methods ofNSView
so that it doessetWantsRestingTouches:YES
osax
trick, see here. There's a wrapper around it called SIMBLI don't write one for you. Rather, if you really, really want to do that, it's a nice opportunity for you to learn the deep tricks of OS X and Objective-C. So, be patient, be willing to learn and have fun!