How can I write a program that when a swipe occurs it draws a line across that frame of the screen and locks it in? - sprite-kit

How can I get something very similar to this but in spriteKit ?
https://jake.in/trap-the-balls/

Related

SwiftUI Execute performDrop() on dropEntered()

I want to execute performDrop() as soon as my finger is over a "droppable Area" which can be detected by using dropEntered(), without lifting the finger from the screen.
https://developer.apple.com/documentation/swiftui/dropdelegate
Is there any way to achieve this?
Jakob

Blinking UIView

For my iPhone app I'm creating some rotating gears with the help of some subclassed UIViews.
I have created subclasses that rotate themselves triggered by a timer.
In one place I have one of these subclasses within another one (so rotation within rotation, think moon rotation around earth and it's own axle). It all rotates fine and dandy, but sometime, like once or twice a minute, I see a very quick white blink in the area of the UIViews. Sometimes in the upper half, sometimes in the lower one and sometimes the whole area (which is only about 128 x 128 pixels).
I rotate by using CGAffineTransformMakeRotation.
I guessed it was due to performance problem, but after simplifying images (no more photoshop made drop shadows in PNG for example) and reducing the number per second the timer is called (2 times per second instead of 5) I still have the problem. CPU load is now down to between 9-25% (from around 47%) when measured in Instruments on a iPhone 3G. Still blinking!
Any clues on where to begin troubleshooting or any better way to rotate images within a view?
All ideas appreciated!
Basically I had an animation in an animation. Not technically skilled enough to say WHY that caused a problem, but removing the second animation solved the problem. My animations were of the type [UIView animateWithDuration... in which I did several CGAffineTransformMakeRotation's

Graphic scrolling in iPhone SDK

I have a graphic that is 3 times the width of an iphone landscape view.
I am trying to auto scroll it so that it appears that it is moving sideways, without using the touchscreen scrolling method.
My aim is to maybe have a button you can press and it moves it left or right across the screen like an animation.
I can deal with everything else but am having trouble finding a solution.
Any example code would be appreciated or even any info on whether it is possible or not.
Thanks. Dave
You can wrap a UIView in an animation block. The animation sweeps the origin value in its frame property from one point to another, over a set period of time.

UISlider Multiple Touch Lag

I'm developing an game which has a component based on UISliders. The player must slide them from left to right one at a time, and on occasion two at a time. The problem lies in the double slides. When sliding two UISliders at a time, the sliders lag behind the player's touches, and often create noticeable lag in the game (this was tested on iPhone 3GS). I'm assuming this is due to the OS trying to recognize a multitouch gesture, but I'm not certain.
My question is what can I do to alleviate the lag? It must be possible because there are drawing apps out there that use up to 5 fingers without much lag, so 2 should be cake.
Let me guess, are you redrawing the screen in the event handler for the UISlider? In which case you are trying to do it redundantly a lot of the time. Instead of redrawing in the event handler, record the change in your view controller. Then you have a timer set up and in that you check to see if your variable is set and if so redraw then.

How to draw with a finger or the iPhone

does anyone have a working sample project showing how can a user can draw simple sketches on the iPhone, with his finger? Something like the GLPaint, but easier, without Open GL.
Something just with the basic drawing functions. I know there was a FingerSketches sample time ago, but it appears it's no longer available.
You're right, there was a FingerSketch example; I'm not sure whether it still works, and I don't think it's a good idea to publish the entire example here. But I think you can use the Touches or MoveMe samples as a starting point to learn how to react to touches.
Basically, you have to remember the last position on each touch event, and draw a line from the last to the current position in touchesMoved and touchesEnded. As usual, FingerSketch doesn't draw directly to the screen, but to a separate drawing context, and then calls [self setNeedsDisplay] to redraw itself.