Re: Continuous animation locks UI?
Re: Continuous animation locks UI?
- Subject: Re: Continuous animation locks UI?
- From: Stephane Sudre <email@hidden>
- Date: Tue, 7 Sep 2010 11:07:29 +0200
Not sure if this is the same on iOS but in Mac OS X, you can call -
[NSRunLoop addTimer: forMode:] on the current run loop.
NSEventTrackingRunLoopMode would be a good candidate.
On Tue, Sep 7, 2010 at 6:32 AM, Dave DeLong <email@hidden> wrote:
> Hi everyone,
>
> I'm working on an iPhone app, and I'm trying to make the title in the navigation bar scroll. I've got a UIView subclass that I wrote that, given a string, will lay out some UILabels and then animate a frame change to give the appearance of scrolling. This works just fine. I instantiate one of these scrolling label objects and set it as the titleView property of my viewController's navigationItem. This also works fine, and the title scrolls as expected.
>
> The problem is that the entire UI is totally unresponsive. Nothing registers user interaction. My timers still fire, the UI can get updated programmatically, but gestures, taps, swipes, etc are all totally ignored. Even the UIBarButtonItems in the navigationItem are unresponsive.
>
> If I take out my scrolling text view, everything works fine (except I obviously don't have a scrolling title). As soon as I put it back in, the UI goes dead.
>
> I'm doing the animations with the 4.0 UIView block-based animation API. I tried using an NSTimer to "animate" frame changing, but parts of my app require dragging for user interaction. The dragging would prevent the timer from firing at consistent intervals, resulting in the scrolling slowing down dramatically. As far as I'm aware, the only reasonable way to animate a user interface element without interfering with the main thread's run loop is with CoreAnimation and layers (correct?).
>
> So:
>
> Why would my scrolling text view be killing my UI? What can I do to get around this?
>
> (For reference, the implementation of my ScrollingTextView is here: http://pastie.org/1142995 , along with a relevant UIView category)
>
> Thanks,
>
> Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden