How to scroll programmetically to selected cover in coverflow view ?
Posted
by hib
on Stack Overflow
See other posts from Stack Overflow
or by hib
Published on 2010-06-14T12:06:52Z
Indexed on
2010/06/15
10:42 UTC
Read the original article
Hit count: 500
iphone
|uiscrollview
Hi all ,
I am using a coverflow component for my application .
It is working nicely till now .
But now I want to scroll to selected cover in coverflow . I am currently doing this :
TKCoverView *cover = [self.coverflow coverAtIndex:currentIndex];
CGRect frame = cover.frame ;
frame.origin.x = frame.origin.x * 1.2; // **main setting**
[self.coverflow bringCoverAtIndexToFront:currentIndex animated:YES];
[self.coverflow scrollRectToVisible:frame animated:YES];
and the cover At index method
- (TKCoverView*) coverflowView:(TKCoverflowView*)coverflowView coverAtIndex:(int)index{
TKCoverView *cover = [coverflowView dequeueReusableCoverView];
NSLog(@"Index value :%i",index);
if(cover == nil){
cover = [[[TKCoverView alloc] initWithFrame:CGRectMake(0, 0, 224, 300)] autorelease]; // 224
cover.baseline = 224;
cover.image = [UIImage imageNamed:@"Placeholder_2.png"];
cover.tag = index;
}else {
cover.image = ((object *)[array objectAtIndex:index]).appIconNormal;
}
return cover;
and
- (TKCoverView*) dequeueReusableCoverView{
if(yard == nil || [yard count] < 1) return nil;
TKCoverView *v = [[[yard lastObject] retain] autorelease];
v.layer.transform = CATransform3DIdentity;
[yard removeLastObject];
return v;
}
So can any one tell me what is the perfect and standard way of setting the frame for the scrollRectToVisibleRegion method .
© Stack Overflow or respective owner