Re: best way to add transitions
Re: best way to add transitions
- Subject: Re: best way to add transitions
- From: Matt Long <email@hidden>
- Date: Tue, 2 Dec 2008 08:50:34 -0700
Gary,
I have to apologize here as the IB interface to transitions seemed
like a sure thing to me so I just replied without testing--something I
try to avoid. Anyhow, I've also tried to implement it in IB as well as
in code, but you're right, no dice. Can't make it work on my end either.
Maybe someone else on the list is familiar with the IKImageView
specifically and the subviews transitions more generically as I've
notice other views you drag onto a window in IB also have this
available. I was able to obtain the image view's image layer in the
sublayers array, however, the memory address changes each time a new
image is displayed so I can't set a transition on the actual image
layer. I also tried to set a transition for a change to the sublayers
on the root layer (the containing layer) of the image view and that
doesn't work either.
I did find this online: https://www.devonferns.com/cocoablog/?p=3 ,
however he is swapping out IKImageViews and transitioning the view
swapping. I suppose that works, but it seems to be a bit of a hack to
me (no offense Devon, if you're on this list. Hacks are often
necessary as this case is starting to prove. ;-) )
Any ideas you other Cocoa heads? Is it even possible to use a
transition between images in a single IKImageView?
Thanks.
-Matt
On Dec 2, 2008, at 2:36 AM, M Pulis wrote:
Matt,
Tried the IB trick, not sure what else to do to start it as now my
images do not show up at all.
My attract mode timer is still firing, calling setImageWithURL to
change the picture every couple seconds, just nothing visual happens.
Turn off IB fade, pictures show and change fine.
Will try the code approach, but, I have my doubts as the IB trick
sounds like it should have been all that is needed, and it does not
work (in my case). I must be missing something.
Read the container doc... still not quite grokking - but getting
clearer. Part of my problem is relative newness to cocoa and still
battling lingo.
Gary
On Dec 1, 2008, at 7:57 PM, Matt Long wrote:
Gary,
I haven't used IKImageView, however, it does implement the
NSAnimatablePropertyContainer protocol:
http://developer.apple.com/documentation/Cocoa/Reference/NSAnimatablePropertyContainer_protocol/Introduction/Introduction.html#/
/apple_ref/occ/intf/NSAnimatablePropertyContainer
This means that you can set its transition animation for a key you
specify. Most notably, the key you want is 'subviews' (I believe).
Try something like this:
[imageView setAnimations: [NSDictionary
dictionaryWithObjectsAndKeys:transition, @"subviews", nil]];
Where 'transition' is a CATransition animation. Something like this:
CATransition *transition=[CATransition animation];
[transition setType:kCATransitionFade];
[transition setSubtype:kCATransitionFromTop];
[transition setDuration:1.0f];
If you don't need to do it in code, you can also select a
transition using Interface Builder. Just click on your IKImageView
view in IB and select the "Effects" tab in the inspector. At the
bottom you'll see a segment called "Transitions". Select "Custom"
and in the Subview drop down, then select "Fade" for the Type.
HTH,
-Matt
On Dec 1, 2008, at 7:54 AM, M Pulis wrote:
Hello Cocoa folk,
My app uses an IKImageView in its main window. Until the user
engages some function, the IK view sequentially displays slides
prompting the user to become involved, a typical attract mode.
What is now requested is a transition such as fade (or any of the
variety of transitions) instead. From reading about views, layers
and transitions (oh my!), I am seeing more trees than forest....
What is the best approach to add transitions to an IKImageView? An
outline should do, I ought to be able to figure out the calls by
now.
Thanks!
Gary
_______________________________________________
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