I am trying to use this bit of code:
[[myUIView layer] addSublayer: layer];
[myScrollView addSubview:myUIView];
[layer addAnimation:[self imagesAni开发者_StackOverflowmation] forKey:@"images"];
What I am doing to do is taking a layer that will later get a CAKeyFrameAnimate and placing that layer inside a UIView so I can use the standard view function:
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return myUIView;
}
But I digress... Then placing the UIView & layer inside of a UIScrollView so I get all of that good UIScrollView functionality.
At least this is how I believe it to work atm.
Hoping for some help currently it just shows a white screen but when I replace the first to lines with:
[[myScrollView layer] addSublayer: layer];
I get an animation that plays but now zooming goodness.
Any help would be appreciated.
EDIT: In summary what I am trying to do is is have a CAKeyFrameAination inside of a layer inside of a UIView inside of a UIScrollView. The reason for this packing is because I need an Animation that can stop start and zoom in. the First three lines of code produce a blank white screen but when I replace them with the last bit where I'm putting the layer on myScrollView it plays but as expected I get no zooming as
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
is expecting an UIView and doesn't work if I tell it to expect a layer. Hope this is clearer.
I thought I was adding the UIView in via code but apparently I needed to add it in via the IB and link it up to the code.
精彩评论