Tag: 滞后

为iOS性能问题绘制应用程序

我正在为iOS创build绘图应用程序。 通过触摸来绘制东西我使用了本教程中的代码: http : //www.raywenderlich.com/18840/how-to-make-a-simple-drawing-app-with-uikit 我用于绘制的代码如下所示: – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { mouseSwiped = NO; UITouch *touch = [touches anyObject]; lastPoint = [touch locationInView:self.view]; } – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { mouseSwiped = YES; UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self.view]; UIGraphicsBeginImageContext(self.view.frame.size); [self.tempDrawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, […]

iOS AssistiveTouch使用自定义键盘时animation较慢

我正在构build一个自定义的键盘,现在一切都很好,除非在启用自定义键盘的过程中使用AssistiveTouch时,点击打开它时,AssistiveTouch的animation有点迟缓(慢放大,缩小)。 我在iPhone 4s和iPhone 6上testing过,同样的麻烦,所以我认为不是关于设备硬件或资源消耗。 任何人有同样的麻烦或知道的原因? 以及如何解决它?

尽pipeprepareToPlay()在Swift中AVAudioPlayer产生滞后

播放一个非常短的声音(〜0.5s)会在Swift中编写的SpriteKit iOS游戏中产生一个呃逆(就像一个延迟)。 在其他问题中,我读了我应该prepareToPlay()声音,我做了。 我甚至用一个variables( soundReady )来检查在播放之前是否准备好声音。 每当播放完成时,我也会重新准备声音( audioPlayerDidFinishPlaying() )。 以下是代码的相关部分: class GameScene: SKScene, AVAudioPlayerDelegate { var splashSound = NSURL() var audioPlayer = AVAudioPlayer() var soundReady = false override func didMoveToView(view: SKView) { let path = NSBundle.mainBundle().pathForResource("plopSound", ofType: "m4a") splashSound = NSURL(fileURLWithPath: path) audioPlayer = AVAudioPlayer(contentsOfURL: splashSound, error: nil) audioPlayer.delegate = self soundReady = audioPlayer.prepareToPlay() } […]