我可以向SKSpriteNode添加边框,类似于UIView吗? [英] Can I add a border to an SKSpriteNode, similar to UIView?

查看:234
本文介绍了我可以向SKSpriteNode添加边框,类似于UIView吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是如果 SKSpriteNode 可以模仿 UIView 的行为,边界和角半径?

I'm interested if an SKSpriteNode can be made to imitate the behavior of a UIView where I can specify border and corner radius?

    self.view.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.view.layer.borderWidth = 2;;
    self.view.layer.cornerRadius = 2;
    self.view.layer.masksToBounds = YES;


推荐答案

虽然你可以只添加一个SKShapeNode作为 path 的子 CGPathCreateWithRoundedRect 创建。

Not natively. Though you can just add a SKShapeNode as child whose path you create with CGPathCreateWithRoundedRect.

这篇关于我可以向SKSpriteNode添加边框,类似于UIView吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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