小编Ash*_*h32的帖子

如何更改CIFilter CIQRCodeGenerator过滤器的背景和前景颜色

我正在尝试为OS X制作一个QR码生成器,但是我还没有继续制作一个更加丰富多彩的QRCode,黑色和白色我正在使用CIQRCodeGenerator进行CIImage过滤器我将如何制作这个我已经在我的应用程序中实现了一个示例代码: -

+ (NSImage *)createQRImageForString:(NSString *)string size:(CGSize)size {
// Setup the QR filter with our string
CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
[filter setDefaults];

NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
[filter setValue:data forKey:@"inputMessage"];
CIImage *image = [filter valueForKey:@"outputImage"];

// Calculate the size of the generated image and the scale for the desired image size
CGRect extent = CGRectIntegral(image.extent);
CGFloat scale = MIN(size.width / CGRectGetWidth(extent), size.height / CGRectGetHeight(extent));

// Since CoreImage nicely interpolates, we need to create a bitmap image that we'll …
Run Code Online (Sandbox Code Playgroud)

macos cocoa qr-code cifilter

8
推荐指数
3
解决办法
3739
查看次数

在Unity中围绕4次射击多个敌人的问题

当我有多个敌人时,他们有一个漂浮的健康号码250.0f.因此,当我向其中一个人射击时,每次向敌人开枪时,这个数字应减少50.但是这是我的问题:第一个敌人死了大约4/5射击它,但当我开始射击另一个(在第一个敌人之后),它需要1次射击并且死亡.

所以这里是玩家Bullet的Bullet脚本,名为Bullet.cs:

public class Bullet : MonoBehaviour {

public GameObject BulletObject;
public GameObject GlobelObjectExplosion;
public GameObject GlobelBulletExplosion;
public float life = 3.0f;
private EnemyAI enemy;


private Transform bulletTransform;
// Use this for initialization
void Start () {

}

void OnTriggerEnter(Collider other)
{
    if(other.gameObject.tag == "Enemy")
    {

        EnemyAI.currEnemyLife -= 50;
        Player.score += 50;

        //Creates an explosion on collision
        GameObject objBullet = Instantiate(GlobelBulletExplosion, transform.position, Quaternion.identity) as GameObject;
        Destroy(objBullet, 2.0f);

        Debug.Log("ColliderWorking");

        if(EnemyAI.currEnemyLife <= 0.0f)
        {
            Destroy(other.gameObject);

            //creates an explosion when enemy …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine

1
推荐指数
1
解决办法
987
查看次数

在Swift中将CoreData保存/同步到iCloud

我无法将我的CoreData同步到iCloud I Keep在控制台中输入错误说 2015-02-22 23:09:31.229 Newstron[1711:233218] -[PFUbiquitySetupAssistant finishSetupWithRetry:](826): CoreData: Ubiquity: <PFUbiquitySetupAssistant: 0x7fbc6357e580>: Retrying after delay: 60 Error Domain=NSCocoaErrorDomain Code=134080 "The operation couldn’t be completed. (Cocoa error 134080.)" UserInfo=0x7fbc637794f0 {Reason=Didn't get a container URL back from URLForUbiquityContainerIdentifier:, giving up now. Please ensure the application is signed with the proper entitlements to read from the container., NSPersistentStoreUbiquitousContainerIdentifierKey=null}

我已经在AppDelegate.swift中获得了代码

// MARK: - Core Data stack
func observeCloudActions(persistentStoreCoordinator psc: NSPersistentStoreCoordinator?) {
    // iCloud notification subscriptions
    let nc = NSNotificationCenter.defaultCenter();
    nc.addObserver(
        self,
        selector: "storesWillChange:",
        name: …
Run Code Online (Sandbox Code Playgroud)

core-data ios icloud swift

0
推荐指数
1
解决办法
2003
查看次数

标签 统计

c# ×1

cifilter ×1

cocoa ×1

core-data ×1

icloud ×1

ios ×1

macos ×1

qr-code ×1

swift ×1

unity-game-engine ×1