basically I have this
@implementation MyView : CPView
{
CPArray MyPanelArray;
}
// Populate the MyPanelArray and position each panel
- (void)initMyView
{
...
}
MyPanels are pretty much wrappers for images. When everything is initialized it draws just fine. Then I have a slider to manipulate the position of the images and the only way I know how to redraw everything is to overwrite the MyView with a new instance and in the main contentView do something like
// Has the correct effect, but feels wrong
- (void)sliderAction:(id)sender
{
var myNewView = [MyView initWithPositionValue:[sender value]];
[_contentView replaceSubview:_myView with:myNewView];
_myView = myNewView;
}
It works all right, but I doubt thats the "right way".
*I know I can use a CPCollectionView for a basic setup, but its not going to work for what I'm trying to accomplish.
Thanks in advance.
From stackoverflow
-
By "redraw" do you mean actually doing a drawRect: or just moving/resizing the image views? If it's the latter then you can just call setFrame: on _myView.
Felix : Wow! Its you, Francisco. Cool. Um, yeah. More simply the problem is that I'm trying to recreate the coverflow effect. I adjust the slider and I need all the images to change position and/or be sheared by an affine transform. I haven't started with animating it, just jumping to new positions. When the slider was adjusted, it would reposition everything and redraw on top of the old state before I tried the replaceSubview:with:.Francisco Ryan Tolmasky I : You should find me on IRC (#cappuccino on freenode) so we can just hack on the code together a bit and I can see what's going on in more context, then we can post the solution back here. I can tell you that if you're going to want to apply affine transform you'll want to use CALayers at some point (which are designed to handle transforms)
0 comments:
Post a Comment