即使在阅读了几帧与视图相关的帖子之后,我仍然无法实现这一点.我打开Xcode(7.3),为IOS创建一个新的游戏项目.在默认场景文件中,在addChild之后,我添加以下代码:
print(self.view!.bounds.width)
print(self.view!.bounds.height)
print(self.frame.size.width)
print(self.frame.size.height)
print(UIScreen.mainScreen().bounds.size.width)
print(UIScreen.mainScreen().bounds.size.height)
Run Code Online (Sandbox Code Playgroud)
当我为iPhone 6s运行时,我得到以下结果:
667.0
375.0
1024.0
768.0
667.0
375.0
Run Code Online (Sandbox Code Playgroud)
我可以猜到前两个数字是Retina Pixel尺寸为x2.我想了解为什么帧大小报告1024x768?
然后我添加以下代码来调整一个简单的背景图像以填充屏幕:
self.anchorPoint = CGPointMake(0.5,0.5)
let theTexture = SKTexture(imageNamed: "intro_screen_phone")
let theSizeFromBounds = CGSizeMake(self.view!.bounds.width, self.view!.bounds.height)
let theImage = SKSpriteNode(texture: theTexture, color: SKColor.clearColor(), size: theSizeFromBounds)
Run Code Online (Sandbox Code Playgroud)
我得到的图像小于屏幕尺寸.如果选择横向模式,图像会显示得更小.
我尝试将边界宽度/高度乘以两个,希望得到实际的屏幕尺寸,但随后图像变得太大.我也试过帧大小,使图像比屏幕稍大.
除了缺乏知识之外,我混淆的主要原因是我在课程中看到了这个完美的例子.要么我错过了一些明显的东西?
如何从SharePoint 2013资源库获取映像的文件名?
我正在尝试编写一个JQuery/REST片段,以根据其他列值搜索库中的图像子集并显示它们.我会使用FileLeafRef文档库,但我在资源库中找不到等效字段.
我到目前为止尝试了以下内容,既没有返回文件名:https:/// crm/_api/Web/Lists/GetByTitle('Publication%20List')/ items?select = File/Name&expand = File https:/// crm/_api /网络/列表/ GetByTitle( '公开%20List')/项目?选择= FileLeafRef