我很好奇什么时候showsFields打开,内存使用量增加得非常快?它可以在30秒内增长到500MB.如果我的mac只有8GB的RAM,我可能在内存警告之前调试不到8分钟,在真实设备上进行调试时最差.
下面的屏幕截图是从真实设备(iOS 9.2)进行测试的.
您可以通过创建一个SpriteKit项目快试试吧,把showsFields在viewDidLoad()法视图控制器内.
skView.showsFields = true
如果您想查看内容showsFields,请将此代码段放在场景的-didMoveToView(view:)方法中.
override func didMoveToView(view: SKView) {
let myField = SKFieldNode.springField()
myField.position = CGPointMake(frame.midX, frame.midY)
myField.strength = 1.0
self.addChild(myField)
}
Run Code Online (Sandbox Code Playgroud)
以下是showsFieldsApple的讨论
讨论
启用此调试选项后,每次渲染帧时,都会在场景后面绘制一个图像,显示场景中包含的任何物理场的效果.
为什么不能使用body::selection,当我想要任何可以突出显示为我想要的颜色的东西时,任何东西都包括p img li h1
这里的例子现在我希望一切都突出显示为红色,但我正在使用body::selection它,它永远不会工作
<?php
class Product extends Eloquent {
protected appends = array('category');
public function category()
{
return $this->belongsTo('Models\Category',
'category_id');
}
}
Run Code Online (Sandbox Code Playgroud)
如何实现呢?
extension SKPhysicsBody {
/// anchorPoint version of init(rectangleOfSize:center:)
convenience init(rectangleOfSize s: CGSize, withAnchorPoint anchorPoint: CGPoint) {
var center = CGPoint()
center.x = (s.width / 2) - ( s.width * anchorPoint.x)
center.y = (s.height / 2 ) - ( s.height * anchorPoint.y)
self.init(rectangleOfSize: s, center: center)
}
}
Run Code Online (Sandbox Code Playgroud)
我在运行时遇到了这个错误
-[PKPhysicsBody initWithRectangleOfSize:withAnchorPoint:]: unrecognized selector sent to instance 0x7f9b03c4fff0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PKPhysicsBody initWithRectangleOfSize:withAnchorPoint:]: unrecognized selector sent to instance 0x7f9b03c4fff0'
Run Code Online (Sandbox Code Playgroud)
这是我在代码中调用的方式
// redBox is a typical SKSpriteNode() …Run Code Online (Sandbox Code Playgroud) 我想得到一个子元素的总offSetTop和总offSetLeft,它们有很多级别的父元素,可能正在加起来.
除了以手动方式逐个添加之外,这是否是任何简写方式?
当我有多个具有相同类的div时,我怎么能只在div上执行动作
http://jsfiddle.net/kent93/Qw7bw/
当鼠标输入一个div时,另一个div也会有动作,我该如何解决这个问题
我只想要我的鼠标进行操作的div,而不是其他,什么是最佳解决方案?
我的代码:
var transformString = Modernizr.prefixed('transform');
var inputDown, inputMove, inputUp;
if (window.Touch) {
inputDown = "touchstart";
inputMove = "touchmove";
inputUp = "touchend";
}
else {
inputDown = "mousedown";
inputMove = "mousemove";
inputUp = "mouseup";
}
var mouse = { startX: 0, startY: 0 };
var innerElement = $('.threedee');
function normalizedX(event){
return window.Touch ? event.originalEvent.touches[0].pageX : event.pageX;
}
function normalizedY(event){
return window.Touch ? event.originalEvent.touches[0].pageY : event.pageY;
}
$(document).bind(inputDown, function(event){
event.preventDefault();
if(event.button === 2) return true; // right-click
mouse.startX = normalizedX(event);
mouse.startY …Run Code Online (Sandbox Code Playgroud) 我想禁用目录的访问,但不禁用.htaccess的子目录
我已经编写了一个重写规则来将所有内容重定向到子目录(public_html),但如果用户知道url,它的父级仍然可访问,我想禁用当前目录的访问而不是子目录
# Turn on rewrites.
RewriteEngine on
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/folder/
# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ /folder/$1
# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ folder/index.php [L]
我想使用html缝合一堆图像,但问题是它们有边距,我使用网络检查器来查找影响这个的属性,但是一小时或更短的时间仍然无法弄明白.
我已经尝试使用psuedo选择器使用负边距左侧,负位置,虽然它工作得很好,但那不是正确的方法吗?
https://dl.dropbox.com/u/2321732/stitch_images/index.html
所以现在我想要最干净的方法来使图像没有任何余量.
我制作了一个画布,它将缝合许多小图像以形成一个大图像。
我写它来监听一个事件,它是一个加载的单个图像对象,然后将其绘制到画布中,在加载下一个将再次触发该事件的图像后,它将按用户指定的数量停止此递归。
因此,在达到用户指定的数量后,我想停止侦听图像对象的“加载”事件,如何使我的图像对象(即“img”)停止侦听事件“加载”?
// 这里调试
网页:https : //dl.dropbox.com/u/2321732/stitch_images/index.html
Javascript:https : //dl.dropbox.com/u/2321732/stitch_images/script/main.js
//为了方便编辑
JSBin:http : //jsbin.com/acakif/1/
注意:我怎么知道活动还在进行中
1.转到网络检查器,javascript控制台
2.
img.src = "https://dl.dropbox.com/u/2321732/stitch_images/images/0_3.jpg"
3.它不应该记录“东西已加载”