私有布尔值:如何使用 Swift 在 SKCropNode 上设置? [英] Private Boolean: how to set on SKCropNode, with Swift?

查看:79
本文介绍了私有布尔值:如何使用 Swift 在 SKCropNode 上设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SKCropNode 的工作原理是从其受影响的节点中删除未被其源图像覆盖的所有事物.这是一种遮罩,另一种是颠倒这种逻辑,并显示源图像未覆盖的所有内容.

SKCropNode works by removing every thing from its affected nodes that are not covered by its source image. This is one type of masking, the other is to invert this logic, and reveal everything that's not covered by the source image.

SKCropNode 有一个布尔开关来设置这个状态,称为 invertMask,足够明智.

SKCropNode has a boolean switch to set this state, called invertMask, sensibly enough.

令人讨厌的是,它看似私人.

What's annoying is that it's seemingly private.

如果抛开所有的应用商店审批流程、私有 API 的危险等,并接受测试是一件有趣的事情……而这只是为了测试……

If putting aside all the app store approval processes, dangers of private APIs, etc, and accepting that it's something interesting to test... and this is only for the purposes of testing...

更新:

对切线相似的问题还有其他答案:

There are other answers to tangentially similar questions:

如何在 Swift 中访问 iOS 私有 API?

然而,这对我没有帮助,也不是如何在 Swift 中设置布尔值的直接答案,这个特定的问题,在这个特定的问题中.

However that doesn't help me, nor is it a direct answer to how to do it for setting a boolean, this particular one, in this particular question, in Swift.

我在这里问了一个关于选择器的问题,并接受了一个答案,告诉我我不需要使用或理解选择器来实现这个目标:什么是 SKAction 中的选择器:perform(_:onTarget:)

I've asked a question about Selectors here, and accepted an answer that showed me I didn't need to use or understand Selectors in order to achieve that goal: What is a selector in SKAction: perform(_:onTarget:)

但看起来可能需要了解使用 Selector 所需的确切语法才能在 Swift 中设置此布尔值.我也不知道那是什么,也不知道怎么做.

But it looks like understanding the exact syntax required to use a Selector might be required to set this boolean in Swift. I don't know what that is, or how to do it, either.

但任何其他设置此布尔值的方法(在 Swift 中)当然都可以.

But any other means of setting this boolean (in Swift) is certainly fine.

推荐答案

根据最新的Xcode 8.1(build 8B62 with Apple Swift version 3.0.1)官方SKCropNode.h 标头如下:

According to the latest Xcode 8.1 (build 8B62 with Apple Swift version 3.0.1) the official SKCropNode.h header is this below:

/**
 @header


 Node that can crop its children's contents with a mask


 @copyright 2011 Apple, Inc. All rights reserved.

 */

#import <SpriteKit/SKNode.h>
#import <SpriteKit/SpriteKitBase.h>

NS_ASSUME_NONNULL_BEGIN

/**
 A SpriteKit node that masks child nodes using another node's alpha component
 */
SK_EXPORT @interface SKCropNode : SKNode

/**
 SKNode to be used as the mask.

 The SKNode supplied as the mask must not be a child of another node, but it may have children. Anywhere the mask's output alpha component is less than 0.05 masks out that area for the SKCropNode's children. If the mask is nil, nothing is masked out.
 */
@property (nonatomic, retain, nullable) SKNode *maskNode;

@end

NS_ASSUME_NONNULL_END

正如你所看到的,没有关于 invertMask 的存在,很抱歉,但我认为这是不可能的.

As you can see there is no presence about invertMask, I'm sorry but I think this is no possible.

这篇关于私有布尔值:如何使用 Swift 在 SKCropNode 上设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆