2014-10-08 86 views
0

我已经完成了一个基于SpriteKit的iOS8游戏玩法iOS8 SpriteKit - 如何显示大量文本?

现在我需要发一条短信给玩家展示«游戏规则»。

但是很难仅使用SKLabelNode以粗体显示大量文本&下划线特别针对不同的语言。

有没有办法通过使用HTML或«WebView»或SpriteKit中的任何其他可接受的技术显示文本消息?

如果不是,也许有人有另一种解决方案?

+0

标签内无格式,但我做了一个基于SKLabelNode的类,允许换行符:https://github.com/nickfalk/NORLabelNode – 2014-10-08 11:37:58

回答

3

您可以定义里面SKScene网络视图,并补充说,这种观点为子视图

CGRect frame = CGRectMake(0,0,200,200); 
//where first 2 var are x and y and rest of the two is width and height 
     UIWebView *webView =[[UIWebView alloc] initWithFrame:frame ]; 
     webView.delegate = self; 
     [webView loadHTMLString:@"<p>I stand here today humbled by the task before us, grateful for the trust you have bestowed, mindful of the sacrifices borne by our ancestors. I thank President Bush for his service to our nation, as well as the generosity and cooperation he has shown throughout this transition</p>" baseURL:Nil]; 
     [self.view addSubview:webView]; 
+0

我需要在.S中的SKScene <* Something here *>旁边添加任何东西吗? – Krekin 2015-03-18 16:27:03

1

这dragoneye在斯威夫特2回答

let frame = CGRect(x: 0, y: 0, width: 320, height: 586) 
    let webview = UIWebView(frame: frame) 
    webview.loadRequest(NSURLRequest(URL: NSURL(string: "https://wikipedia.org")!)) 
    webview.delegate = self 
    view.addSubview(webview)