SPTween freezes when dragging/zooming a view inside UIScrollView - ios

I am using Sparrow framework. I have been playing with moving sprites around using SPTween and SXParticleSystem. The problem is when I move or resize a view inside UIScrollView, those tween and particles just freeze. When I end dragging, the sprite moves again, not from where it froze but they move from where they should be if it weren't frozen. How can animate those sprites along side with other animating UIKit elements.
I did try to use CoreAnimation (UIView animation) and drag the scrollview. It doesn't freeze. Any ideas?
CADisplayLink OpenGL rendering breaks UIScrollView behaviour
Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone
I have seen these similar post above and they suggest that the moving the scrollview changes the runLoopMode to one that OpenGL doesn't normally use. But I still don't know how to change the runLoops in Sparrow framework.
View full size

Solution found. In SPView.m line , change NSDefaultRunLoopMode to NSRunLoopCommonModes. The reason is the default OpenGL rendering in Sparrow is registered using NSDefaultRunLoopMode, which that mode will stop running in some circumstances such as a UI update. For more info, please read the link below.
What are runloops and what modes can we use?
https://stackoverflow.com/a/7223765/467588

Related

Animated UIWebView does not respond to touches during animation

At the moment, I'm animating a UIWebView from the bottom of the screen to the top. As the UIWebView animates upwards it becomes untouchable for 50-80% of the duration time.
If I tap the UIWebviews ending destination, or model layer, the taps are registered and the Webview responds appropriately.
Why is this? And what solutions are there for tapping moving/animating UIWebViews?
To further exemplify this, I have created a side project that shows a UIWebView animating upwards. The purple squares represent touch events on the presentation layer, while the blue squares represent touch events outside of the presentation layer.
https://github.com/AdamBCo/UIWebView-Animation-Issues
As seen in the example, UIViewAnimationOptionAllowUserInteraction is set in the UViewAnimation block.
A UIWebView is complicated layout of web elements. To redraw that during animation there is simply not enough time available to entirely redraw the UIWebView, keep the controls in it available for interaction and do the animation.
However there are some settings for this inside a CALayer on what to do with its contents when animating it. I would start looking into that.

UIView inside UIScrollView becoming touch-unresponsive with iOS 7.1

I am developing an iPad app which presents to the user a set of zoomable pages. There is a (paged) UIScrollView used for scrolling between pages, and each page consists of another UIScrollView which allows pinch&zoom, and contains as subview the actual page content which is a custom UIView subclass with CALayer drawings.
Everything was working fine as of iOS 7.0.x. Unfortunately, when running the app on iPads updated to iOS 7.1, the pages'UIView is completely unresponsive to touch events: none of the UIGestureRecognizers attached to it is ever fired, touchesBegan/Moved/Ended methods are never called, and even pinch gestures that should be captured by the parent ScrollView are not recognized anymore if they happen inside the UIView's bounds (outside of it, they work).
When i set to NO the parent Scrollviews' scrollEnabled property, the touch events properly reach the UIView but of course this is not the behavior I need.
Apple documentation doesn't say anything about changes in UIKit framework, and I also have no clue on how to debug this, since on previous iOS releases everything was working as expected.
Any idea?
Edit 31/03/2014:
I was able to do some more debug, and noted that if I omit to add to the UIView's CALayer a couple of sublayers (that come from two custom subclasses of UIView), the problem doesn't occur.
I ended up solving my issue.
What I did was to stop adding the CALayers as sub-layers to the UIVIew, and instead adding the CALayers' parent views as sub-views to the main UIView.
I still have no idea on why this is happening in 7.1, given that no changes from 7.0 was mentioned in the documentation for this topic.
Anyhow, hope this can help...

iOS 7 SpriteKit Scrolling Menu?

I decided to jump into SpriteKit to start working on a game and I'm a little stuck on how I would create a scrolling menu (like Cut the Rope or Angry Birds for example) that would scroll through the various chapters in the game. I know that when I used Cocos2D there was a CCScrollLayer that would take the items (such as images or buttons) for each chapter and then create the scrolling layer but I can't seem to find something similar in SpriteKit. I was thinking that I could probably use a UIScrollView, but not sure if that is the best way to go or if anyone has found anything else that would work for this.
I have found that using a UIScrollView works well for me. From an SKScene you have access to the parent view; self.view. From the scene's didMoveToView: method you can add a UIScrollView and remove/hide it from the willMoveFromView: method.

Background pattern jumping when animating UIScrollView.contentOffset manually

I'm attempting to animate the contentOffset of a UIScrollView by hand using the old-style [UIView beginAnimations:context:] method. I'm animating it instead of using setContentOffset:animated: because I want to control the duration. I'm using the old-style method rather than using blocks because I'm targeting iOS 3 and above (as an aside, is that a valid thing to do?).
When it animates, the subviews animate fine, but the background pattern jumps as if it wasn't being animated at all.
Does anyone know if there's anything special I have to do to get this work?
Thanks!
Edit: Current bodge is to have a vanilla UIView with its own background pattern within the scroll view. Far from ideal though :-(
What you need is autoScrolling / programmatically scrolling. Here it is
http://www.aaron.griffith.name/weblog/2011/02/23/scrolling-a-uiscrollview-programmatically/

How to delay flipping a UIView containing an updating UIButton having a gradient background

I have two views that flip based on a button press within the view. The view has two CAGradientLayers as sublayers. If I flip immediately after the action method fires, the button is in the process of changing the opacity of the gradients and so you see stuttering (the UIVIew flip animation is having to accommodate the button that is itself changing.)
I can hack a solution by doing a performWithSelection:withObject:afterDelay:0.1f, but it feels like such a hack. I tried setting the layer's needsDisplay property and testing for when it was clears, but probably this is insufficient to tell me the screen itself has redrawn.
Dav
In the end this has no solution. I have since found that when animating a view there are severe performance implication if you also try to animate the super views. You can see this in many iOS apps where the app animates an image in a scrolling list - the scrolling stumbles.
So what I learned is either animate something, or it's view, but not both!

Resources