小编Nic*_*arr的帖子

如何从SKScene呈现UIViewController?

我通过Sprite Kit进入iOS,我认为这是不明智的.

我的目标是在游戏结束时显示"分享"按钮.点击共享按钮应该呈现SLComposeViewController(Twitter Share).场景的内容不应该改变.

决定"游戏结束"的游戏逻辑存在于SpriteMyScene.m中,这是SKScene的子类.

我可以通过这种方式在Game上显示Share按钮:

-(void)update:(CFTimeInterval)currentTime {

if (gameOver){
  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
                [button addTarget:self
                           action:@selector(sendToController)
                forControlEvents:UIControlEventTouchDown];
                [button setTitle:@"Show View" forState:UIControlStateNormal];
                button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
                [self.view addSubview:button]; 
    }
}

- (void)sendToController
{
    NSLog(@"ok");
    SpriteViewController *viewController = [SpriteViewController alloc];
    [viewController openTweetSheet];
}
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是试图让showTweetButton方法起作用.我的SpriteViewController.m看起来像这样:

- (void)openTweetSheet
    {
     SLComposeViewController *tweetSheet = [SLComposeViewController
                                           composeViewControllerForServiceType:
                                           SLServiceTypeTwitter];

    // Sets the completion handler.  Note that we don't know which thread the
    // block will be called on, so we need to ensure that …
Run Code Online (Sandbox Code Playgroud)

objective-c uiviewcontroller uiview ios sprite-kit

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

错误:未定义的方法'link_to_remote'

我是RJS的新手,我遵循本指南中的简短示例

我在application.html.erb中包含了所有默认的javascript库

当我启动服务器并检查页面时,我收到一个错误:

Showing /Users/PowerBook/Desktop/makprojects/drummercymbal/app/views/videos/show.html.erb where line #9 raised:

undefined method `link_to_remote' for #<#<Class:0x217f64>:0x213d74>
Extracted source (around line #9):

6:   <li>Cat</li>
7:   <li>Mouse</li>
8: </ul>
9: <%= link_to_remote("Add a fox", :url => { :action => :add}) %>
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

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

无法使用anchorPoint垂直定向SKLabelNode

我想使用Sprite Kit制作一个基于文本的游戏(那些学习打字游戏).

我以为我会使用SKLabelNode作为字符串,但是当我尝试设置anchorPoint以便旋转它时,我得到一个错误,即SKLabelNode没有anchorPoint属性:

 SKLabelNode *hello = [SKLabelNode labelNodeWithFontNamed:@"Courier-Bold"];
 hello.text = @"Hello,";
//this throws an error:
 hello.anchorPoint = CGPointMake(0.5,1.0);
Run Code Online (Sandbox Code Playgroud)

什么是好的解决方法?我如何垂直定位我的文本字符串,同时使用physicsBody将它们视为物理对象?

objective-c rotation sprite-kit

7
推荐指数
2
解决办法
6072
查看次数

没有说明为什么 Apple 拒绝了我的 TestFlight External 构建

我今天早上检查了 iTunes Connect,发现我的外部测试人员预发布版本的状态已从审核中更改为已拒绝。与正常的发布提交不同,没有解释,也没有到调解中心的链接。也没有收到电子邮件(检查垃圾邮件)。

我已经联系了 Apple,但有没有其他人遇到过这个问题?

xcode testflight app-store-connect

5
推荐指数
0
解决办法
1871
查看次数

UTapGestureRecognizer不适用于.began状态

我已经为我添加了两个手势识别器UIView:

func tap(sender: UITapGestureRecognizer){
    if sender.state == .began {
        print("snapping photo")
    }

}
func longPress(sender: UILongPressGestureRecognizer) {
    if sender.state == .began {
        print("snapping video")
    }
}
Run Code Online (Sandbox Code Playgroud)

当两者都设置为时state == .began,仅longPress触发.当我点击时.ended,两个都开火了.

为什么在状态设置为时不点击工作.began

uigesturerecognizer ios swift

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